Move the packages and keys into their own packages

Not the easiest thing to review, since some of the moved files needed some changes to make this work.

Improve #282.
Resolve #291.
This change is bad; the comments are no longer [adjacent](http://blog.golang.org/godoc-documenting-go-code) and will thus no longer be part of the packages documentation.