Updated protocol to use error_t