more changes, added selectable output directory