Some restructuring and addition qr functionality