fleshed out more tests
fixed several bugs