move functins around in main