Open database only when needed
Predictable number of lines
Small fixes + decreased lock time