fixed all compile errors. Most tests pass - yay