Made reference counted object faster, smaller and probably safer
Fixed GCC errors