better ok/error encoding