Remove unused code.
Rename and simplify some internal methods.
Add clarifying comment.
Remove unused methods.
Unlock database if open fails.
Merge remote-tracking branch 'remotes/origin/master' into repl