replace name function with attr_accessor