Refactor coding style. Expand monitoring