Added some code to pretty print return codes in debug mode.