diff --git a/ext/json/ext/generator/generator.c b/ext/json/ext/generator/generator.c
index 5192723..8fd4c85 100644
--- a/ext/json/ext/generator/generator.c
+++ b/ext/json/ext/generator/generator.c
@@ -136,7 +136,7 @@ static int hash_to_json_i(VALUE key, VALUE value, VALUE buf)
  * produced JSON string output further.
  * _depth_ is used to find out nesting depth, to indent accordingly.
  */
-static VALUE mHash_to_json(int argc, VALUE *argv, VALUE self)
+static VALUE mHash_to_json(VALUE self, SEL sel, int argc, VALUE *argv)
 {
     VALUE Vstate, Vdepth, result;
     long depth;
@@ -241,7 +241,7 @@ inline static VALUE mArray_json_transfrom(VALUE self, VALUE Vstate, VALUE Vdepth
  * produced JSON string output further.
  * _depth_ is used to find out nesting depth, to indent accordingly.
  */
-static VALUE mArray_to_json(int argc, VALUE *argv, VALUE self) {
+static VALUE mArray_to_json(VALUE self, SEL sel, int argc, VALUE *argv) {
     VALUE Vstate, Vdepth, result;
 
     rb_scan_args(argc, argv, "02", &Vstate, &Vdepth);
@@ -271,7 +271,7 @@ static VALUE mArray_to_json(int argc, VALUE *argv, VALUE self) {
  *
  * Returns a JSON string representation for this Integer number.
  */
-static VALUE mInteger_to_json(int argc, VALUE *argv, VALUE self)
+static VALUE mInteger_to_json(VALUE self, SEL sel, int argc, VALUE *argv)
 {
     return rb_funcall(self, i_to_s, 0);
 }
@@ -281,7 +281,7 @@ static VALUE mInteger_to_json(int argc, VALUE *argv, VALUE self)
  *
  * Returns a JSON string representation for this Float number.
  */
-static VALUE mFloat_to_json(int argc, VALUE *argv, VALUE self)
+static VALUE mFloat_to_json(VALUE self, SEL sel, int argc, VALUE *argv)
 {
     JSON_Generator_State *state = NULL;
     VALUE Vstate, rest, tmp;
@@ -312,7 +312,7 @@ static VALUE mFloat_to_json(int argc, VALUE *argv, VALUE self)
  *
  * Extends _modul_ with the String::Extend module.
  */
-static VALUE mString_included_s(VALUE self, VALUE modul) {
+static VALUE mString_included_s(VALUE self, SEL sel, VALUE modul) {
     return rb_funcall(modul, i_extend, 1, mString_Extend);
 }
 
@@ -323,7 +323,7 @@ static VALUE mString_included_s(VALUE self, VALUE modul) {
  * returns a JSON string encoded with UTF16 big endian characters as
  * \u????.
  */
-static VALUE mString_to_json(int argc, VALUE *argv, VALUE self)
+static VALUE mString_to_json(VALUE self, SEL sel, int argc, VALUE *argv)
 {
     VALUE result = rb_str_buf_new(RSTRING_LEN(self));
     rb_str_buf_cat2(result, "\"");
@@ -340,7 +340,7 @@ static VALUE mString_to_json(int argc, VALUE *argv, VALUE self)
  * method should be used, if you want to convert raw strings to JSON
  * instead of UTF-8 strings, e. g. binary data.
  */
-static VALUE mString_to_json_raw_object(VALUE self) {
+static VALUE mString_to_json_raw_object(VALUE self, SEL sel) {
     VALUE ary;
     VALUE result = rb_hash_new();
     rb_hash_aset(result, rb_funcall(mJSON, i_create_id, 0), rb_class_name(rb_obj_class(self)));
@@ -355,10 +355,10 @@ static VALUE mString_to_json_raw_object(VALUE self) {
  * This method creates a JSON text from the result of a call to
  * to_json_raw_object of this String.
  */
-static VALUE mString_to_json_raw(int argc, VALUE *argv, VALUE self) {
-    VALUE obj = mString_to_json_raw_object(self);
+static VALUE mString_to_json_raw(VALUE self, SEL sel, int argc, VALUE *argv) {
+    VALUE obj = mString_to_json_raw_object(self, nil);
     Check_Type(obj, T_HASH);
-    return mHash_to_json(argc, argv, obj);
+    return mHash_to_json(obj, nil, argc, argv);
 }
 
 /*
@@ -379,7 +379,7 @@ static VALUE mString_Extend_json_create(VALUE self, VALUE o) {
  *
  * Returns a JSON string for true: 'true'.
  */
-static VALUE mTrueClass_to_json(int argc, VALUE *argv, VALUE self)
+static VALUE mTrueClass_to_json(VALUE self, SEL sel, int argc, VALUE *argv)
 {
     return rb_str_new2("true");
 }
@@ -389,7 +389,7 @@ static VALUE mTrueClass_to_json(int argc, VALUE *argv, VALUE self)
  *
  * Returns a JSON string for false: 'false'.
  */
-static VALUE mFalseClass_to_json(int argc, VALUE *argv, VALUE self)
+static VALUE mFalseClass_to_json(VALUE self, SEL sel, int argc, VALUE *argv)
 {
     return rb_str_new2("false");
 }
@@ -398,7 +398,7 @@ static VALUE mFalseClass_to_json(int argc, VALUE *argv, VALUE self)
  * call-seq: to_json(state = nil, depth = 0)
  *
  */
-static VALUE mNilClass_to_json(int argc, VALUE *argv, VALUE self)
+static VALUE mNilClass_to_json(VALUE self, SEL sel, int argc, VALUE *argv)
 {
     return rb_str_new2("null");
 }
@@ -410,11 +410,11 @@ static VALUE mNilClass_to_json(int argc, VALUE *argv, VALUE self)
  * it to a JSON string, and returns the result. This is a fallback, if no
  * special method #to_json was defined for some object.
  */
-static VALUE mObject_to_json(int argc, VALUE *argv, VALUE self)
+static VALUE mObject_to_json(VALUE self, SEL sel, int argc, VALUE *argv)
 {
     VALUE string = rb_funcall(self, i_to_s, 0);
     Check_Type(string, T_STRING);
-    return mString_to_json(argc, argv, string);
+    return mString_to_json(string, nil, argc, argv);
 }
 
 /* 
@@ -438,11 +438,11 @@ static void State_mark(JSON_Generator_State *state)
 
 static JSON_Generator_State *State_allocate()
 {
-    JSON_Generator_State *state = ALLOC(JSON_Generator_State);
+    JSON_Generator_State *state = (JSON_Generator_State *)xmalloc(sizeof(JSON_Generator_State));
     return state;
 }
 
-static VALUE cState_s_allocate(VALUE klass)
+static VALUE cState_s_allocate(VALUE klass, SEL sel)
 {
     JSON_Generator_State *state = State_allocate();
     return Data_Wrap_Struct(klass, State_mark, -1, state);
@@ -454,7 +454,7 @@ static VALUE cState_s_allocate(VALUE klass)
  * Configure this State instance with the Hash _opts_, and return
  * itself.
  */
-static inline VALUE cState_configure(VALUE self, VALUE opts)
+static inline VALUE cState_configure(VALUE self, SEL sel, VALUE opts)
 {
     VALUE tmp;
     GET_STATE(self);
@@ -491,11 +491,7 @@ static inline VALUE cState_configure(VALUE self, VALUE opts)
     }
     tmp = ID2SYM(i_check_circular);
 
-#if WITH_OBJC
     if (CFDictionaryGetValueIfPresent((CFDictionaryRef)opts, (const void *)RB2OC(tmp), 0)) {
-#else
-    if (st_lookup(RHASH_TBL(opts), tmp, 0)) {
-#endif
         tmp = rb_hash_aref(opts, ID2SYM(i_check_circular));
         state->check_circular = RTEST(tmp);
     } else {
@@ -503,11 +499,7 @@ static inline VALUE cState_configure(VALUE self, VALUE opts)
     }
     tmp = ID2SYM(i_max_nesting);
     state->max_nesting = 19;
-#if WITH_OBJC
     if (CFDictionaryGetValueIfPresent((CFDictionaryRef)opts, (const void *)RB2OC(tmp), 0)) {
-#else
-    if (st_lookup(RHASH_TBL(opts), tmp, 0)) {
-#endif
         VALUE max_nesting = rb_hash_aref(opts, tmp);
         if (RTEST(max_nesting)) {
             Check_Type(max_nesting, T_FIXNUM);
@@ -527,7 +519,7 @@ static inline VALUE cState_configure(VALUE self, VALUE opts)
  * Returns the configuration instance variables as a hash, that can be
  * passed to the configure method.
  */
-static VALUE cState_to_h(VALUE self)
+static VALUE cState_to_h(VALUE self, SEL sel)
 {
     VALUE result = rb_hash_new();
     GET_STATE(self);
@@ -561,7 +553,7 @@ static VALUE cState_to_h(VALUE self)
  *   generated, otherwise an exception is thrown, if these values are
  *   encountered. This options defaults to false.
  */
-static VALUE cState_initialize(int argc, VALUE *argv, VALUE self)
+static VALUE cState_initialize(VALUE self, SEL sel, int argc, VALUE *argv)
 {
     VALUE opts;
     GET_STATE(self);
@@ -577,7 +569,7 @@ static VALUE cState_initialize(int argc, VALUE *argv, VALUE self)
         state->allow_nan = 0;
         state->max_nesting = 19;
     } else {
-        cState_configure(self, opts);
+        cState_configure(self, nil, opts);
     }
     state->seen = rb_hash_new();
     state->memo = Qnil;
@@ -592,7 +584,7 @@ static VALUE cState_initialize(int argc, VALUE *argv, VALUE self)
  * new State instance configured by _opts_, something else to create an
  * unconfigured instance. If _opts_ is a State object, it is just returned.
  */
-static VALUE cState_from_state_s(VALUE self, VALUE opts)
+static VALUE cState_from_state_s(VALUE self, SEL sel, VALUE opts)
 {
     if (rb_obj_is_kind_of(opts, self)) {
         return opts;
@@ -608,7 +600,7 @@ static VALUE cState_from_state_s(VALUE self, VALUE opts)
  *
  * This string is used to indent levels in the JSON text.
  */
-static VALUE cState_indent(VALUE self)
+static VALUE cState_indent(VALUE self, SEL sel)
 {
     GET_STATE(self);
     return state->indent;
@@ -619,7 +611,7 @@ static VALUE cState_indent(VALUE self)
  *
  * This string is used to indent levels in the JSON text.
  */
-static VALUE cState_indent_set(VALUE self, VALUE indent)
+static VALUE cState_indent_set(VALUE self, SEL sel, VALUE indent)
 {
     GET_STATE(self);
     Check_Type(indent, T_STRING);
@@ -632,7 +624,7 @@ static VALUE cState_indent_set(VALUE self, VALUE indent)
  * This string is used to insert a space between the tokens in a JSON
  * string.
  */
-static VALUE cState_space(VALUE self)
+static VALUE cState_space(VALUE self, SEL sel)
 {
     GET_STATE(self);
     return state->space;
@@ -644,7 +636,7 @@ static VALUE cState_space(VALUE self)
  * This string is used to insert a space between the tokens in a JSON
  * string.
  */
-static VALUE cState_space_set(VALUE self, VALUE space)
+static VALUE cState_space_set(VALUE self, SEL sel, VALUE space)
 {
     GET_STATE(self);
     Check_Type(space, T_STRING);
@@ -656,7 +648,7 @@ static VALUE cState_space_set(VALUE self, VALUE space)
  *
  * This string is used to insert a space before the ':' in JSON objects.
  */
-static VALUE cState_space_before(VALUE self)
+static VALUE cState_space_before(VALUE self, SEL sel)
 {
     GET_STATE(self);
     return state->space_before;
@@ -667,7 +659,7 @@ static VALUE cState_space_before(VALUE self)
  *
  * This string is used to insert a space before the ':' in JSON objects.
  */
-static VALUE cState_space_before_set(VALUE self, VALUE space_before)
+static VALUE cState_space_before_set(VALUE self, SEL sel, VALUE space_before)
 {
     GET_STATE(self);
     Check_Type(space_before, T_STRING);
@@ -680,7 +672,7 @@ static VALUE cState_space_before_set(VALUE self, VALUE space_before)
  * This string is put at the end of a line that holds a JSON object (or
  * Hash).
  */
-static VALUE cState_object_nl(VALUE self)
+static VALUE cState_object_nl(VALUE self, SEL sel)
 {
     GET_STATE(self);
     return state->object_nl;
@@ -692,7 +684,7 @@ static VALUE cState_object_nl(VALUE self)
  * This string is put at the end of a line that holds a JSON object (or
  * Hash).
  */
-static VALUE cState_object_nl_set(VALUE self, VALUE object_nl)
+static VALUE cState_object_nl_set(VALUE self, SEL sel, VALUE object_nl)
 {
     GET_STATE(self);
     Check_Type(object_nl, T_STRING);
@@ -704,7 +696,7 @@ static VALUE cState_object_nl_set(VALUE self, VALUE object_nl)
  *
  * This string is put at the end of a line that holds a JSON array.
  */
-static VALUE cState_array_nl(VALUE self)
+static VALUE cState_array_nl(VALUE self, SEL sel)
 {
     GET_STATE(self);
     return state->array_nl;
@@ -715,7 +707,7 @@ static VALUE cState_array_nl(VALUE self)
  *
  * This string is put at the end of a line that holds a JSON array.
  */
-static VALUE cState_array_nl_set(VALUE self, VALUE array_nl)
+static VALUE cState_array_nl_set(VALUE self, SEL sel, VALUE array_nl)
 {
     GET_STATE(self);
     Check_Type(array_nl, T_STRING);
@@ -728,7 +720,7 @@ static VALUE cState_array_nl_set(VALUE self, VALUE array_nl)
  * Returns true, if circular data structures should be checked,
  * otherwise returns false.
  */
-static VALUE cState_check_circular_p(VALUE self)
+static VALUE cState_check_circular_p(VALUE self, SEL sel)
 {
     GET_STATE(self);
     return state->check_circular ? Qtrue : Qfalse;
@@ -740,7 +732,7 @@ static VALUE cState_check_circular_p(VALUE self)
  * This integer returns the maximum level of data structure nesting in
  * the generated JSON, max_nesting = 0 if no maximum is checked.
  */
-static VALUE cState_max_nesting(VALUE self)
+static VALUE cState_max_nesting(VALUE self, SEL sel)
 {
     GET_STATE(self);
     return LONG2FIX(state->max_nesting);
@@ -752,7 +744,7 @@ static VALUE cState_max_nesting(VALUE self)
  * This sets the maximum level of data structure nesting in the generated JSON
  * to the integer depth, max_nesting = 0 if no maximum should be checked.
  */
-static VALUE cState_max_nesting_set(VALUE self, VALUE depth)
+static VALUE cState_max_nesting_set(VALUE self, SEL sel, VALUE depth)
 {
     GET_STATE(self);
     Check_Type(depth, T_FIXNUM);
@@ -766,7 +758,7 @@ static VALUE cState_max_nesting_set(VALUE self, VALUE depth)
  * Returns true, if NaN, Infinity, and -Infinity should be generated, otherwise
  * returns false.
  */
-static VALUE cState_allow_nan_p(VALUE self)
+static VALUE cState_allow_nan_p(VALUE self, SEL sel)
 {
     GET_STATE(self);
     return state->allow_nan ? Qtrue : Qfalse;
@@ -777,7 +769,7 @@ static VALUE cState_allow_nan_p(VALUE self)
  *
  * Returns _true_, if _object_ was already seen during this generating run. 
  */
-static VALUE cState_seen_p(VALUE self, VALUE object)
+static VALUE cState_seen_p(VALUE self, SEL sel, VALUE object)
 {
     GET_STATE(self);
     return rb_hash_aref(state->seen, rb_obj_id(object));
@@ -789,7 +781,7 @@ static VALUE cState_seen_p(VALUE self, VALUE object)
  * Remember _object_, to find out if it was already encountered (if a cyclic
  * data structure is rendered). 
  */
-static VALUE cState_remember(VALUE self, VALUE object)
+static VALUE cState_remember(VALUE self, SEL sel, VALUE object)
 {
     GET_STATE(self);
     return rb_hash_aset(state->seen, rb_obj_id(object), Qtrue);
@@ -800,7 +792,7 @@ static VALUE cState_remember(VALUE self, VALUE object)
  *
  * Forget _object_ for this generating run.
  */
-static VALUE cState_forget(VALUE self, VALUE object)
+static VALUE cState_forget(VALUE self, SEL sel, VALUE object)
 {
     GET_STATE(self);
     return rb_hash_delete(state->seen, rb_obj_id(object));
@@ -819,54 +811,54 @@ void Init_generator()
     eCircularDatastructure = rb_path2class("JSON::CircularDatastructure");
     eNestingError = rb_path2class("JSON::NestingError");
     cState = rb_define_class_under(mGenerator, "State", rb_cObject);
-    rb_define_alloc_func(cState, cState_s_allocate);
-    rb_define_singleton_method(cState, "from_state", cState_from_state_s, 1);
-    rb_define_method(cState, "initialize", cState_initialize, -1);
-
-    rb_define_method(cState, "indent", cState_indent, 0);
-    rb_define_method(cState, "indent=", cState_indent_set, 1);
-    rb_define_method(cState, "space", cState_space, 0);
-    rb_define_method(cState, "space=", cState_space_set, 1);
-    rb_define_method(cState, "space_before", cState_space_before, 0);
-    rb_define_method(cState, "space_before=", cState_space_before_set, 1);
-    rb_define_method(cState, "object_nl", cState_object_nl, 0);
-    rb_define_method(cState, "object_nl=", cState_object_nl_set, 1);
-    rb_define_method(cState, "array_nl", cState_array_nl, 0);
-    rb_define_method(cState, "array_nl=", cState_array_nl_set, 1);
-    rb_define_method(cState, "check_circular?", cState_check_circular_p, 0);
-    rb_define_method(cState, "max_nesting", cState_max_nesting, 0);
-    rb_define_method(cState, "max_nesting=", cState_max_nesting_set, 1);
-    rb_define_method(cState, "allow_nan?", cState_allow_nan_p, 0);
-    rb_define_method(cState, "seen?", cState_seen_p, 1);
-    rb_define_method(cState, "remember", cState_remember, 1);
-    rb_define_method(cState, "forget", cState_forget, 1);
-    rb_define_method(cState, "configure", cState_configure, 1);
-    rb_define_method(cState, "to_h", cState_to_h, 0);
+    rb_objc_define_method(cState, "alloc", cState_s_allocate, 0);
+    rb_objc_define_method(*(VALUE *)cState, "from_state", cState_from_state_s, 1);
+    rb_objc_define_method(cState, "initialize", cState_initialize, -1);
+
+    rb_objc_define_method(cState, "indent", cState_indent, 0);
+    rb_objc_define_method(cState, "indent=", cState_indent_set, 1);
+    rb_objc_define_method(cState, "space", cState_space, 0);
+    rb_objc_define_method(cState, "space=", cState_space_set, 1);
+    rb_objc_define_method(cState, "space_before", cState_space_before, 0);
+    rb_objc_define_method(cState, "space_before=", cState_space_before_set, 1);
+    rb_objc_define_method(cState, "object_nl", cState_object_nl, 0);
+    rb_objc_define_method(cState, "object_nl=", cState_object_nl_set, 1);
+    rb_objc_define_method(cState, "array_nl", cState_array_nl, 0);
+    rb_objc_define_method(cState, "array_nl=", cState_array_nl_set, 1);
+    rb_objc_define_method(cState, "check_circular?", cState_check_circular_p, 0);
+    rb_objc_define_method(cState, "max_nesting", cState_max_nesting, 0);
+    rb_objc_define_method(cState, "max_nesting=", cState_max_nesting_set, 1);
+    rb_objc_define_method(cState, "allow_nan?", cState_allow_nan_p, 0);
+    rb_objc_define_method(cState, "seen?", cState_seen_p, 1);
+    rb_objc_define_method(cState, "remember", cState_remember, 1);
+    rb_objc_define_method(cState, "forget", cState_forget, 1);
+    rb_objc_define_method(cState, "configure", cState_configure, 1);
+    rb_objc_define_method(cState, "to_h", cState_to_h, 0);
 
     mGeneratorMethods = rb_define_module_under(mGenerator, "GeneratorMethods");
     mObject = rb_define_module_under(mGeneratorMethods, "Object");
-    rb_define_method(mObject, "to_json", mObject_to_json, -1);
+    rb_objc_define_method(mObject, "to_json", mObject_to_json, -1);
     mHash = rb_define_module_under(mGeneratorMethods, "Hash");
-    rb_define_method(mHash, "to_json", mHash_to_json, -1);
+    rb_objc_define_method(mHash, "to_json", mHash_to_json, -1);
     mArray = rb_define_module_under(mGeneratorMethods, "Array");
-    rb_define_method(mArray, "to_json", mArray_to_json, -1);
+    rb_objc_define_method(mArray, "to_json", mArray_to_json, -1);
     mInteger = rb_define_module_under(mGeneratorMethods, "Integer");
-    rb_define_method(mInteger, "to_json", mInteger_to_json, -1);
+    rb_objc_define_method(mInteger, "to_json", mInteger_to_json, -1);
     mFloat = rb_define_module_under(mGeneratorMethods, "Float");
-    rb_define_method(mFloat, "to_json", mFloat_to_json, -1);
+    rb_objc_define_method(mFloat, "to_json", mFloat_to_json, -1);
     mString = rb_define_module_under(mGeneratorMethods, "String");
-    rb_define_singleton_method(mString, "included", mString_included_s, 1);
-    rb_define_method(mString, "to_json", mString_to_json, -1);
-    rb_define_method(mString, "to_json_raw", mString_to_json_raw, -1);
-    rb_define_method(mString, "to_json_raw_object", mString_to_json_raw_object, 0);
+    rb_objc_define_method(*(VALUE *)mString, "included", mString_included_s, 1);
+    rb_objc_define_method(mString, "to_json", mString_to_json, -1);
+    rb_objc_define_method(mString, "to_json_raw", mString_to_json_raw, -1);
+    rb_objc_define_method(mString, "to_json_raw_object", mString_to_json_raw_object, 0);
     mString_Extend = rb_define_module_under(mString, "Extend");
-    rb_define_method(mString_Extend, "json_create", mString_Extend_json_create, 1);
+    rb_objc_define_method(mString_Extend, "json_create", mString_Extend_json_create, 1);
     mTrueClass = rb_define_module_under(mGeneratorMethods, "TrueClass");
-    rb_define_method(mTrueClass, "to_json", mTrueClass_to_json, -1);
+    rb_objc_define_method(mTrueClass, "to_json", mTrueClass_to_json, -1);
     mFalseClass = rb_define_module_under(mGeneratorMethods, "FalseClass");
-    rb_define_method(mFalseClass, "to_json", mFalseClass_to_json, -1);
+    rb_objc_define_method(mFalseClass, "to_json", mFalseClass_to_json, -1);
     mNilClass = rb_define_module_under(mGeneratorMethods, "NilClass");
-    rb_define_method(mNilClass, "to_json", mNilClass_to_json, -1);
+    rb_objc_define_method(mNilClass, "to_json", mNilClass_to_json, -1);
 
     i_to_s = rb_intern("to_s");
     i_to_json = rb_intern("to_json");
diff --git a/ext/json/ext/parser/parser.rl b/ext/json/ext/parser/parser.rl
index e20fc2b..dab6171 100644
--- a/ext/json/ext/parser/parser.rl
+++ b/ext/json/ext/parser/parser.rl
@@ -479,7 +479,7 @@ static char *JSON_parse_string(JSON_Parser *json, char *p, char *pe, VALUE *resu
  *   additions even if a matchin class and create_id was found. This option
  *   defaults to true.
  */
-static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self)
+static VALUE cParser_initialize(VALUE self, SEL sel, int argc, VALUE *argv)
 {
     char *ptr;
     long len;
@@ -498,11 +498,7 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self)
             rb_raise(rb_eArgError, "opts needs to be like a hash");
         } else {
             VALUE tmp = ID2SYM(i_max_nesting);
-#if WITH_OBJC
             if (CFDictionaryGetValueIfPresent((CFDictionaryRef)opts, (const void *)RB2OC(tmp), 0)) {
-#else
-            if (st_lookup(RHASH_TBL(opts), tmp, 0)) {
-#endif
                 VALUE max_nesting = rb_hash_aref(opts, tmp);
                 if (RTEST(max_nesting)) {
                     Check_Type(max_nesting, T_FIXNUM);
@@ -514,22 +510,14 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self)
                 json->max_nesting = 19;
             }
             tmp = ID2SYM(i_allow_nan);
-#if WITH_OBJC
             if (CFDictionaryGetValueIfPresent((CFDictionaryRef)opts, (const void *)RB2OC(tmp), 0)) {
-#else
-            if (st_lookup(RHASH_TBL(opts), tmp, 0)) {
-#endif
                 VALUE allow_nan = rb_hash_aref(opts, tmp);
                 json->allow_nan = RTEST(allow_nan) ? 1 : 0;
             } else {
                 json->allow_nan = 0;
             }
             tmp = ID2SYM(i_create_additions);
-#if WITH_OBJC
             if (CFDictionaryGetValueIfPresent((CFDictionaryRef)opts, (const void *)RB2OC(tmp), 0)) {
-#else
-            if (st_lookup(RHASH_TBL(opts), tmp, 0)) {
-#endif
                 VALUE create_additions = rb_hash_aref(opts, tmp);
                 if (RTEST(create_additions)) {
                     json->create_id = rb_funcall(mJSON, i_create_id, 0);
@@ -570,7 +558,7 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self)
  *  Parses the current JSON text _source_ and returns the complete data
  *  structure as a result.
  */
-static VALUE cParser_parse(VALUE self)
+static VALUE cParser_parse(VALUE self, SEL sel)
 {
     char *p, *pe;
     int cs = EVIL;
@@ -591,8 +579,7 @@ static VALUE cParser_parse(VALUE self)
 
 inline static JSON_Parser *JSON_allocate()
 {
-    JSON_Parser *json = ALLOC(JSON_Parser);
-    MEMZERO(json, JSON_Parser, 1);
+    JSON_Parser *json = (JSON_Parser *)xcalloc(1, sizeof(JSON_Parser));
     return json;
 }
 
@@ -607,7 +594,7 @@ static void JSON_free(JSON_Parser *json)
     free(json);
 }
 
-static VALUE cJSON_parser_s_allocate(VALUE klass)
+static VALUE cJSON_parser_s_allocate(VALUE klass, SEL sel)
 {
     JSON_Parser *json = JSON_allocate();
     return Data_Wrap_Struct(klass, JSON_mark, JSON_free, json);
@@ -619,7 +606,7 @@ static VALUE cJSON_parser_s_allocate(VALUE klass)
  * Returns a copy of the current _source_ string, that was used to construct
  * this Parser.
  */
-static VALUE cParser_source(VALUE self)
+static VALUE cParser_source(VALUE self, SEL sel)
 {
     GET_STRUCT;
     return rb_str_dup(json->Vsource);
@@ -632,10 +619,11 @@ void Init_parser()
     cParser = rb_define_class_under(mExt, "Parser", rb_cObject);
     eParserError = rb_path2class("JSON::ParserError");
     eNestingError = rb_path2class("JSON::NestingError");
-    rb_define_alloc_func(cParser, cJSON_parser_s_allocate);
-    rb_define_method(cParser, "initialize", cParser_initialize, -1);
-    rb_define_method(cParser, "parse", cParser_parse, 0);
-    rb_define_method(cParser, "source", cParser_source, 0);
+    
+    rb_objc_define_method(cParser, "alloc", cJSON_parser_s_allocate, 0);
+    rb_objc_define_method(cParser, "initialize", cParser_initialize, -1);
+    rb_objc_define_method(cParser, "parse", cParser_parse, 0);
+    rb_objc_define_method(cParser, "source", cParser_source, 0);
 
     CNaN = rb_const_get(mJSON, rb_intern("NaN"));
     CInfinity = rb_const_get(mJSON, rb_intern("Infinity"));
diff --git a/gc.c b/gc.c
index 1add8d7..29a6a9f 100644
--- a/gc.c
+++ b/gc.c
@@ -792,11 +792,17 @@ id2ref(VALUE obj, SEL sel, VALUE objid)
  */
 
 VALUE
-rb_obj_id(VALUE obj, SEL sel)
+rb_obj_id_imp(VALUE obj, SEL sel)
 {
     return (VALUE)LONG2NUM((SIGNED_VALUE)obj);
 }
 
+VALUE
+rb_obj_id(VALUE obj)
+{
+    return rb_obj_id_imp(obj, nil);
+}
+
 /*
  *  call-seq:
  *     ObjectSpace.count_objects([result_hash]) -> hash
@@ -940,7 +946,7 @@ rb_call_os_finalizer2(VALUE obj, VALUE table)
     critical_save = rb_thread_critical;
     rb_thread_critical = Qtrue;
 
-    args[1] = rb_ary_new3(1, rb_obj_id(obj, 0));
+    args[1] = rb_ary_new3(1, rb_obj_id(obj));
     args[2] = (VALUE)rb_safe_level();
 
     for (i = 0, count = RARRAY_LEN(table); i < count; i++) {
@@ -1070,9 +1076,9 @@ Init_GC(void)
     rb_global_variable(&nomem_error);
     nomem_error = rb_exc_new2(rb_eNoMemError, "failed to allocate memory");
 
-    rb_objc_define_method(rb_mKernel, "hash", rb_obj_id, 0);
-    rb_objc_define_method(rb_mKernel, "__id__", rb_obj_id, 0);
-    rb_objc_define_method(rb_mKernel, "object_id", rb_obj_id, 0);
+    rb_objc_define_method(rb_mKernel, "hash", rb_obj_id_imp, 0);
+    rb_objc_define_method(rb_mKernel, "__id__", rb_obj_id_imp, 0);
+    rb_objc_define_method(rb_mKernel, "object_id", rb_obj_id_imp, 0);
 
     rb_objc_define_method(*(VALUE *)rb_mObSpace, "count_objects", count_objects, -1);
 }
diff --git a/include/ruby/intern.h b/include/ruby/intern.h
index cd3286a..44a5088 100644
--- a/include/ruby/intern.h
+++ b/include/ruby/intern.h
@@ -435,7 +435,7 @@ VALUE rb_obj_untrust(VALUE);
 VALUE rb_obj_untrusted(VALUE);
 VALUE rb_obj_freeze(VALUE);
 VALUE rb_obj_frozen_p(VALUE);
-//VALUE rb_obj_id(VALUE);
+VALUE rb_obj_id(VALUE);
 VALUE rb_obj_class(VALUE);
 VALUE rb_class_real(VALUE);
 VALUE rb_class_inherited_p(VALUE, VALUE);
@@ -563,6 +563,7 @@ VALUE rb_str_dup(VALUE);
 VALUE rb_str_locktmp(VALUE);
 VALUE rb_str_unlocktmp(VALUE);
 VALUE rb_str_dup_frozen(VALUE);
+VALUE rb_str_times(VALUE, VALUE);
 long rb_str_sublen(VALUE, long);
 VALUE rb_str_substr(VALUE, long, long);
 VALUE rb_str_subseq(VALUE, long, long);
diff --git a/rakelib/builder.rake b/rakelib/builder.rake
index 545e5bd..6893e62 100644
--- a/rakelib/builder.rake
+++ b/rakelib/builder.rake
@@ -312,7 +312,7 @@ SCRIPT_ARGS = "--make=\"/usr/bin/make\" --dest-dir=\"#{DESTDIR}\" --extout=\"#{E
 EXTMK_ARGS = "#{SCRIPT_ARGS} --extension --extstatic"
 INSTRUBY_ARGS = "#{SCRIPT_ARGS} --data-mode=0644 --prog-mode=0755 --installed-list #{INSTALLED_LIST} --mantype=\"doc\" --sym-dest-dir=\"#{SYM_INSTDIR}\""
 
-EXTENSIONS = ['ripper', 'digest', 'readline', 'libyaml', 'fcntl']
+EXTENSIONS = ['ripper', 'digest', 'readline', 'libyaml', 'fcntl', 'json']
 def perform_extensions_target(target)
   EXTENSIONS.map { |x| File.join('ext', x) }.each do |ext_dir|
     Dir.glob(File.join(ext_dir, '**/extconf.rb')) do |p|
diff --git a/string.c b/string.c
index 38596aa..2fedc28 100644
--- a/string.c
+++ b/string.c
@@ -465,7 +465,7 @@ rb_str_plus(VALUE str1, SEL sel, VALUE str2)
  */
 
 static VALUE
-rb_str_times(VALUE str, SEL sel, VALUE times)
+rb_str_times_imp(VALUE str, SEL sel, VALUE times)
 {
     VALUE str2;
     long n, len;
@@ -486,6 +486,12 @@ rb_str_times(VALUE str, SEL sel, VALUE times)
     return str2;
 }
 
+VALUE
+rb_str_times(VALUE str, VALUE times)
+{
+    return rb_str_times_imp(str, nil, times);
+}
+
 /*
  *  call-seq:
  *     str % arg   => new_str
@@ -5609,7 +5615,7 @@ Init_String(void)
     rb_objc_define_method(rb_cString, "eql?", rb_str_eql, 1);
     rb_objc_define_method(rb_cString, "casecmp", rb_str_casecmp, 1);
     rb_objc_define_method(rb_cString, "+", rb_str_plus, 1);
-    rb_objc_define_method(rb_cString, "*", rb_str_times, 1);
+    rb_objc_define_method(rb_cString, "*", rb_str_times_imp, 1);
     rb_objc_define_method(rb_cString, "%", rb_str_format_m, 1);
     rb_objc_define_method(rb_cString, "[]", rb_str_aref_m, -1);
     rb_objc_define_method(rb_cString, "[]=", rb_str_aset_m, -1);
