Added error messaging for diagnosis