code refactored (no semantical changes intended)