cleanups and tests