Separate out functionality into a library.