Moved printouts to separate functions, crude solution to problem