Support for functions
Refactor