Everything changed
Generic model implementation v1
Functional version at last (not very efficient).

We need to fix several TODOs in the code.