Added some fixes, some tests