factoring out a base template