Added set attributes to avoid overwriting attributes when constructing.