Fixes and cleanups