started to refactor. many things are broken.
Seemed to fix most of the errors from refactoring.