refactoring: moved methods to prototype