Use util.inherits instead of substituting methods inplace
Added debugging