changes for readability and fixing a bug in build template refs