Fixed an issue where addOption would not find the proper place to insert into when optgroups are specified & index is not.
Example here: https://jsfiddle.net/me8v1fyp/
The index calculation doesn't recognize that that.$element.children() is the list of optgroups when they are specified, so it places the new option after the last optgroup - instead of entering the specified group (nested) to insert into.
Fix addOption when 'nested' specified
Tidied up code (realized the logic was already there, just out of order).
Cleaned it up -- as it turns out, all that had to be done was initialize $container first, and use it to find the index in place of that.$element.