Restructured into main and sample to better decouple testing and setup.