Add a bunch of tests, clean up the local file variable code.