These read functions seem very similiar could they be extracted to a common functions?