Bug fixed and added tests
Updated README