#297 Merge templates back, remove unused classes and code