Fixed example and readme to reflect how the library actually works

Neither example.js nor the example in the readme.md work. Updated both to work.