Fixed some things based on Hans recommendations.

Some renaming and tweaking of some template apis.