Refactor to use prototype.