Changing my program to not use pointers where not necessary