refactor prototype