Port to cstruct; add basic creation utilities