Clean up: Moved templates and classes to external files.