Refactoring e testes