Moved all code into a single C file.