Final refactoring done