Database logic modified