Added optimization to read entire bytes when possible