prototype refactor