Drafted QZ code. Seems to be okay at first pass

Should fix #3