Prototype for QR. Some cleanup