winding func re-arranged