refactored js, updated readme and history.md, added example.html