Create base template and remove dupe code