Changed the way tests are done, and fixed some of the bugs