use foreach instead of array_map to reduce speed it up a bit