first steps at restructuring and getting the app into a test harness