Rewrite to use the libraries.