Various tweaks in the script file

This is not really a pull request - just a suggestion on writing a DSL!

The main change that I'd do is to move all the type definitions to the beginning of the file (or, later, to a single file at the beginning of your project). This way, you have a clear separation between the domain model and the implementation.

To do this, I used `type SingleField<'T> with`, which lets you move all the members to a later part of the file. When attaching members, you also do not need the `with` keyword, so I removed that.