added --debug and --version flags