Changed Error codes to be an enum