moved the handling part to when-monitor