code refactoring 2