Refactoring: "installed.db" handling is separated to functions.