Refactor to use attr_reader instead of accessing directly to instance variables