Work on improving main monitoring script for efficiency and code readability