adding templarte selector and removing exits and print_r calls from templates controller