tidy up and finish templates