More complex database structure.
Fix compilation issues.