Restructuring for stage 2

Did some restructuring for project stage 2 (see commits).