refactoring problems form homeworks