Refactor by defining proper instance variables and properties.