code generation, handling raw monitor