Broke off functions into a library.