Added error codes to process functions