Add checks, do cleanups