refactor to use attr_reader