Reorganised code and removed older sections.