hw5 with templates