IMO this block should be moved to a method too, the last only needs to be done in Bundle command, the rest in the Bridge command.