random cleanups and improvements