updated the code so that it actually works, along with a few more comments on example usage.