Updated to use classes instead of boring old plain-Python.