changed a few functions to use pointers