begin restructuring of code