Cleanups and fixes