Templated everything. Closes #5