turn logic