More Bug Fixes and Cleanup