Refactoring rebuild method