Cleanup, minor bug fixes