implemented -d and -u options.