added more tests and fixed a few problems that were found while writing them