Fix accidental global 'opt' var. Cleanup

Fix for accidental 'opt' var polluting global namespace.
Remove alert.
Cleanup.