restructuring variables and sets