Added error checks along with hints about source of error