Big refactoring to add Function and recursive structures
Improve diagrams