tidy up flags and options