Cleanups and minor modifications