some improvements in error handling, prettify output