Reorganized some methods and moved some common instance variables to the parent class.