lib: use structs instead of types