refactored and added test template