Refactor to use util.inherits