Add some tests, restructure stuff.