Started to test and fixed some bugs