pointers
using templates
cleanup and simplify