fixed rest of refactoring, seems to be working!
fixed unit tests