Bug Fixes and cleaning