Added some tests, corrected some errors