implement --out option as requested in #8