use reduce for fewer LOC