Handle invalid opcode exception.
Use RAII locking.
Improvements to reaper.
Removed redundant code.