Update hand.py

Needs documentation and code cleanup.