rewrote some parts to cope better with '-o' options (required for -bme