more efficient buffer reading