fixing issue #21

using a template