Completed updateHand function