refactor completo