Further improvements for structure. Sample now works with safer code.