Move clearing of target squares to after drag end