refactor with attr_{reader,accessor}