cleanups and more checking