Changed most variables to class attributes.