Fix structure preparation. Fix apply_rules
Add table_definitions. Support simple attributes definitions