lots of cosmetic stuff...some random bug fixes...add more tests