add location_attr variable and improve set class attrs