def main():
    """Run the script."""

    parser = argparse.ArgumentParser()
    parser.add_argument('--ccd',
                        action='store',
                        type=int,
                        default=None,
                        help='which ccd to process')
    parser.add_argument("--dbimages",
                        action="store",
                        default="vos:OSSOS/dbimages",
                        help='vospace dbimages containerNode')
    parser.add_argument("expnums",
                        type=int,
                        nargs=3,
                        help="expnums to scramble")
    parser.add_argument("--nosort",
                        action='store_true',
                        default=False,
                        help="do not sort before processing")
    parser.add_argument("--type",
                        action='store',
                        default='p',
                        choices=['p', 'o'],
                        help='which type of image')
    parser.add_argument("--verbose", "-v",
                        action="store_true")
    parser.add_argument("--debug", '-d',
                        action='store_true')
    parser.add_argument("--dry-run", action="store_true", help="Do not copy back to VOSpace, implies --force")
    parser.add_argument("--force", action='store_true')
    
    args = parser.parse_args()
    prefix = ""
    task = util.task()
    dependency = "update_header"

    storage.DBIMAGES = args.dbimages

    ## setup logging
    level = logging.CRITICAL
    if args.debug:
        level = logging.DEBUG
    elif args.verbose:
        level = logging.INFO

    logging.basicConfig(level=level, format="%(message)s")
    logging.getLogger('vos').setLevel(level)
    logging.getLogger('vos').addHandler(logging.StreamHandler())
    
    if not args.nosort:
        args.expnums.sort()

    ccds = [args.ccd]
    exit_status = 0
    if args.ccd is None:
        ccds = range(0, 36)
    for ccd in ccds:
        storage.set_logger(task, prefix, args.expnums[0], ccd, args.type, args.dry_run)
        expnums = args.expnums
        if not (args.force or args.dry_run) and storage.get_status(task, prefix, expnums[0], version='s', ccd=ccd):
            continue
        message = storage.SUCCESS

        try:
            scramble(expnums=expnums, ccd=ccd, version='p', dry_run=args.dry_run)
        except Exception as e:
            logging.error(e)
            message = str(e)
            exit_status = message
        if not args.dry_run:
            storage.set_status(task, prefix, expnums[0], version='s', ccd=ccd, status=message)
    return exit_status