Minor cleanups, and addition of test