Refactoring the auto_flash_from_TWCI