Move function to the right location