Minor refactoring of a method