Removed code duplication (Sourceforege#3567952 reported by hugh redelmeier)