more cleanups and minor modifications