Wrote some tests, and fixed some bugs !