added -v and -d arguments to control logging verbosity