fixes and tests
Almost done
Almost done
Done