Rearranged code into more sensibly named files.