Trying to figure out generic function and pointers