Code for debugging with REEM