First stab at a more object-oriented approach.