Use only one forEach method instead of two