cleaning up and removing unnecessary code from templates