refactor to remove html generation S3 method