Refactoring of method