Trace option in command line
Some tidying up of the main procedure