Clean this up by using `array_map` or something?