Maybe a comment here explaining that `types` passed in is an array of MIME types. (it would help explain the `split('/')` code)