implemented end turn logic