Added tests, fixed some bugs, added license, improvide readme