Finished the class. Entirely untested though...