Cleanups and minor fixes