Implemented better error handling, be more verbose on erroneous input