Added some tests, fixed some bugs, not done yet!