Add tests, restructure.