improve handleConnections performance, add db indices (thanks wuselfuzz), less frequent polling