Fixed bug where selecting an item by number would fail if there were mul...

...tiple items with the same value. Added some jsdocs. Fixed a bug with the file field with tab completion where it wouldn't work if using forward slashes on Windows or backslash+space on Linux/Mac. Minor code cleanup.