Remove repetitive lines by using mapping function over list

Arguably make it less readable in the process, but ho-hum.