Testing is long over due
Added some tests and fixed some bugs