Refactored tests in template.rs to not use any functions outside the file