Some code refactoring in monitoring service