Bug Fixes and Cleanup