added support for -o flag