Adding monitoring to chapter4 examples