changed template loading to be more clear and not crash when for loop finishes regardless of whether or not a valid file was found.