Some cleanup on database lookup handling.