cleaned up code, moved all console spew to main