Code refactoring 2