restructuring code for future work