Added error processing