Add tests and fix _some_ things