modified qr parsing code