Continued: using templates to make pattern reusable.

Still WIP.