template logic is no fun