moving function to the right position