fix struct example

also some code cleanup