Expose and document math libraries, clean up some tests