Cleaned up templates and set hierarchy