Major rehaul to: 1. Improve code quality;  2. Fully implement serialisation functions.  3.  Begin validation implementation.  4.  Simplify generated code layout.