Large restructuring to seperate code due to increasing size...