Add fixes for issues #16 and #17 - bad enterMode and replace escape() with encodeURLComponent().