Cleaned up code and modified the print statements slightly