Rearanged so it is more "object oriented"