Move the code out to the library.