c -> cpp, RAII
struct -> class
Some cosmetic changes