domain library and cleanups