Improvement to database indexing

Signed-off-by: crynobone <crynobone@gmail.com>
Merge branch 'staging'