added support for -r and -f arguments in the cmd