nicer code emitter, more checks