Instead of repeating all the lines can we simply setup a hash of key, value pairs which we can iterate through? That saves the code duplication.