Added check for empty options
Added handling of dynamically loaded content