Break up into functions, NOW WITH POINTERS