lexington.py: refactor into classes