bug fixes

Cleaned up some more code, fixed a few crippling bugs.