Added unittest, could be improved