updated pub with forEach in place of generic for in loop