refectoring - class to attr