Refactoring using methods