refactoring, documentation, and a script!

refactored the code, mostly by better method-naming

added a script with various command line options to
make generating the test file easier.

wrote more documentation