cleaned up code

cleaned up and add some formatting for output