Some tests and some algorithms.