all code here just restructuring