Adding templated version of registerTo & unregisterTo