Refactoring the methods