WIP
debugged, all tests pass