refactoring
use ByteString to read bytes