move function to prototype