Large scale refactors, added printlines also for clarity. Renamed many modules for clarity.