File organising, code cleanup