This should not have been a single commit. Now we have input files. Also, I've restructured the code and renamed modules.