Cleanups and Bug fixes