fixed a bunch of errrors, cleaned up some stuff