Cleaning up some code to enable proper JS templates