Adding ability for simple error messaging and more detailed if debug=true.