Added error code retrieval and clearing