made code DRYer by using attr_accessor, attr_reader, and attr_writer attributes.