More improvements to error handling. Output now more polished.