Initial conversion to a package

Very "brute-force" attempt.  Bare minimum to convert to a package.  Avoided rearranging any code.  Runs and passes `go test`, but not much testing beyond that.  Consider this a conversation starter.

There were a few things I would like to do along with this, but I wanted to avoid doing too much in an initial attempt.