Cleaned up some of how printing function works.