Move keyup handler into function
Update qr encoder