fixed the main objects error handling and cleaned up the output