Move to a array.map instead of foreach