working version with ref vars
at() works for int

need to generalize to T*
Templated at() working...needs testing