Bug Fixes

Bug Fixes and some cleanup and additions