Move functions to the right place.