Fixed bugs, and wrote a readme.md