MAJOR refactor. Behaviour is close to compiling
Merge