[refactor] attach methods to the prototype