cleanups and minor improvements