refactored out the library into its own file.