cleanup
Fixed several bugs and misfeatures
Cleanup