Add new template model constructs and refactored some.
Merged drop all from obfu.