oldflash option

added oldflash option and cleaned some code