Splits up the libraries, and adds some tests