use bufio.Scanner with ScanLines for input, instead of fmt.Scanln

hat tip to @razzius for reporting this and offering a fix!
read one byte at a time. Fixes #4
yet another readline fix
Allow specifying output. Closes #1
Refactoring as requested by @bgentry