Get the minimum viable of the command working.

Stripped debug code out
Tidied up some flag handling
Get it working with and without the -f flag.