Deduping of main options is now in a function.
Formatting of code for better readability.