made it work with structs