Add functionality to collect all parameters that are reference values

By combining collect and collectReferenceParameters this will make it easy for users to pull out all the variable names they would need to compile the template.

Also, fix a bug where collectTemplates() doesn't explore the 'else' of a block.