implemented Mark's sweet template!