Better error handling, return more info on errors