improved struct handling