database reworking -- optimizations and simplification in code;