Refactored to work towards a single parent class that does most of the work.