Small makefile correction and minor refactor with improved template
usage