finished updateHand function