move function to inner scope