Move utlitiy functions into separate files
correct handling of templates on linux
Move convenience function into separate file