Restructure and build with cargo.
Add tests