non-working version with structs