separate func and routine