A new template following refcnt implementation

Closes #1