Modified to be a library.