Cleaned up javascript and template file