Restructure set_attributes