pi code for smooth turns - best attempt