Reworked some options, bug fixes

Changes and bug fixes to get autocomplete working in [codecombat](https://github.com/codecombat/codecombat).  Hopefully they're useful for this project as well.
Fixes #1