Reorganised sourcefile into a more logical layout.