Tidy up - extracted inputStreamToBytes method into IO object and removed duplicates