changed responses to return byte arrays to support images and made content-type dynamic