refactor a funcional