Tidied up engine + form generator code.

* Reduced complex syntax
* Fixed some inconsistencies between form & engine