some cleanups and improvements