isLocal can be determined at the beginning
Unnecessary function call
Improved memmon event listener