adding more tests, fixing bugs