merge Adam's callback parsing code; update generated code