Removed debugging variable
Merged conditional with upper else if
Replaced map by forEach since the returning value is not used
Wrapped code under acting conditional

contexts and reversedContexts only made sense inside id !== this