reworking emit for scope cancellation, also better doc format