Refactored invokeCallbacks() method to use native forEach