added flag and command line interface