Rewrite using a bufio.Reader