Extract a few things to lib/