Refactor mrbc_context_new func