added a test, cleanups, minor fixes