Moved Templates and Minor refactoring