Move templates into folders. Fix small bugs.