Bug fixes

Cleaned up some unnecessary code.