diff --git a/soitool/codebook_model_view.py b/soitool/codebook_model_view.py
index e1857621d0676df93ee8c5dab79c3bd3b13d8bc1..6bcf314dfc9694cb945539ea0ad1cd9bdb8bc79f 100644
--- a/soitool/codebook_model_view.py
+++ b/soitool/codebook_model_view.py
@@ -1,4 +1,4 @@
-"""Codebook.
+"""GUI-interface towards database-table 'CodeBook'.
 
 Contains functionality for viewing, editing and inserting new rows
 in the database-table 'CodeBook'.
@@ -6,7 +6,6 @@ in the database-table 'CodeBook'.
 from PySide2.QtWidgets import QTableView
 from PySide2.QtSql import QSqlDatabase, QSqlTableModel
 from PySide2.QtCore import Qt
-from soitool.database import DBPATH  # , Database
 from soitool.style import CODEBOOK_HEADER_FONT, CODEBOOK_HEADER_BACKGROUND_CSS
 
 # Name and type of database
@@ -17,17 +16,20 @@ DBTYPE = "QSQLITE"
 class CodeBookTableView(QTableView):
     """TableView with a model of the 'codebook'-table from database.
 
-    This modified QTableView creates a CodeBookTableModel,
-    which reads the codebook-table.
-    User can add, edit and insert entries to the database through this View.
+    This modified QTableView creates a CodeBookTableModel, which reads the
+    codebook-table. User can add, edit, delete and insert entries through this
+    view.
+
+    Parameter 'database' should be an instance of soitool.database.Database,
+    and is used to create a QSqlDatabase from the database-file.
 
     Raises RuntimeError if database does not open.
     """
 
-    def __init__(self):
+    def __init__(self, database):
         super().__init__()
         db = QSqlDatabase.addDatabase(DBTYPE, CONNAME)
-        db.setDatabaseName(DBPATH)
+        db.setDatabaseName(database.db_path)
 
         if not db.open():
             raise RuntimeError("Could not open database.")
diff --git a/soitool/codebook_to_pdf.py b/soitool/codebook_to_pdf.py
index 7d090539a86b35ed5eb5600c67a8cc52b07e155b..991b105c9eb147f4f2f6b5d35871be02b73a1a9d 100644
--- a/soitool/codebook_to_pdf.py
+++ b/soitool/codebook_to_pdf.py
@@ -14,7 +14,6 @@ from reportlab.lib.styles import ParagraphStyle
 from reportlab.lib import colors
 from reportlab.lib.pagesizes import A4, portrait
 from reportlab.lib.units import cm
-from soitool.database import Database
 from soitool.enumerates import CodebookSort
 
 A4_WIDTH, A4_HEIGHT = A4
@@ -53,11 +52,15 @@ TABLE_STYLE = TableStyle(
 )
 
 
-def generate_codebook_pdf(small=False, page_size=A4, orientation=portrait):
+def generate_codebook_pdf(
+    database, small=False, page_size=A4, orientation=portrait
+):
     """Generate PDF with data from database-table 'CodeBook'.
 
     Parameters
     ----------
+    database : soitool.database.Database
+        Reference to database-instance.
     small : bool, optional
         Data is from full codebook if False (default),
         from small codebook if True.
@@ -75,7 +78,7 @@ def generate_codebook_pdf(small=False, page_size=A4, orientation=portrait):
         title_decode = Paragraph(TITLE_FULL_DECODE, TITLE_STYLE)
 
     # Get data from database
-    data_code, data_decode = get_codebook_data(small)
+    data_code, data_decode = get_codebook_data(database, small)
 
     # Create Tables with data sorted by Word/Code and set predefined style
     table_code = Table(data_code, repeatRows=1)
@@ -130,11 +133,13 @@ def generate_filename(small=False):
     return f"Kodebok_{today}.pdf"
 
 
-def get_codebook_data(small=False):
+def get_codebook_data(database, small=False):
     """Read and format codebook-data from database sorted by Word and Code.
 
     Parameters
     ----------
+    database : soitool.database.Database
+        Reference to database-instance.
     small : bool
         Retrieves full codebook if False (default), small codebook if True.
 
@@ -145,9 +150,8 @@ def get_codebook_data(small=False):
         the second list is a decodebook (sorted by Code).
     """
     # Get data from CodeBook-table
-    db = Database()
-    db_data_code = db.get_codebook(small, sort=CodebookSort.WORD)
-    db_data_decode = db.get_codebook(small, sort=CodebookSort.CODE)
+    db_data_code = database.get_codebook(small, sort=CodebookSort.WORD)
+    db_data_decode = database.get_codebook(small, sort=CodebookSort.CODE)
 
     # Lists to append column-headers and formatted data
     data_code = []
diff --git a/soitool/database.py b/soitool/database.py
index 0f7f1838acbebc40699a3744c459b646d1e78673..cc0c69d8655e819c504d083de14bca65daf7a5b1 100644
--- a/soitool/database.py
+++ b/soitool/database.py
@@ -6,7 +6,7 @@ from datetime import datetime
 import soitool.coder
 from soitool.enumerates import CodebookSort
 
-# Set name and path to (future) database
+# Set name and path to default (future) database
 DBNAME = "database"
 CURDIR = os.path.dirname(__file__)
 DBPATH = os.path.join(CURDIR, DBNAME)
@@ -16,14 +16,16 @@ SECONDS_IN_24H = 24 * 60 * 60
 
 # DDL-statements for creating tables
 CODEBOOK = (
-    "CREATE TABLE CodeBook"
-    "(Word VARCHAR PRIMARY KEY NOT NULL CHECK(length(Word) > 0), "
+    "CREATE TABLE CodeBook("
+    "Word VARCHAR PRIMARY KEY NOT NULL CHECK(length(Word) > 0), "
     "Category VARCHAR, "
     "Type VARCHAR DEFAULT 'Stor' CHECK(Type='Stor' OR Type='Liten'), "
     "Code VARCHAR UNIQUE)"
 )
 CATEGORYWORDS = (
-    "CREATE TABLE CategoryWords" "(Word VARCHAR PRIMARY KEY, Category VARCHAR)"
+    "CREATE TABLE CategoryWords("
+    "Word VARCHAR PRIMARY KEY, "
+    "Category VARCHAR NOT NULL CHECK(length(Category) > 0))"
 )
 BYHEART = "CREATE TABLE ByHeart(Word VARCHAR PRIMARY KEY)"
 
@@ -31,34 +33,36 @@ LASTUPDATED = "CREATE TABLE LastUpdated(Timestamp DATETIME PRIMARY KEY)"
 
 
 class Database:
-    """
-    Holds database-connection and related functions.
+    """Holds database-connection and related functions.
 
-    Connects to existing db if found, creates new db if not.
+    Uses default database unless parameter 'db_path', path to a database-file,
+    is given. Connects to existing db if found, creates new db if not.
     If db is created, tables are created and filled.
 
     Holds a QTimer that requests an update of CodeBook on every timeout.
     """
 
-    def __init__(self):
+    def __init__(self, db_path=DBPATH):
+
+        self.db_path = db_path
 
-        db_exists = os.path.exists(DBPATH)
+        db_exists = os.path.exists(self.db_path)
 
         if db_exists:
             print("Connecting to existing DB.")
-            self.conn = sqlite3.connect(DBPATH)
+            self.conn = sqlite3.connect(db_path)
             print("DB-connection established.")
 
         else:
             print("Creating new DB.")
-            self.conn = sqlite3.connect(DBPATH)
+            self.conn = sqlite3.connect(db_path)
 
             self.create_tables()
             print("DB created.")
             self.fill_tables()
             print("Tables filled with data.")
 
-        self.conn.row_factory = sqlite3.Row  # Enables row['columnName']
+        self.conn.row_factory = sqlite3.Row  # Enables row["columnName"]
 
     def create_tables(self):
         """Create tables CodeBook, CategoryWords and ByHeart."""
diff --git a/soitool/main_window.py b/soitool/main_window.py
index 462b8af7d2d68c291a0c234c7c109c9a8239903b..93ca55e666b702f52ed87a9bdf940307c53bc971 100644
--- a/soitool/main_window.py
+++ b/soitool/main_window.py
@@ -1,7 +1,6 @@
 """Inclues the main window of our application.
 
 Built up by widgets implemented in other modules.
-
 """
 import sys
 import os
@@ -30,17 +29,19 @@ class ModuleType(Enum):
 
 
 class MainWindow(QMainWindow):
-    """MainWindow, skallet til hele applikasjonen."""
+    """MainWindow, shell of the entire application.
+
+    Parameter 'db_path' is the path to an existing or future database-file.
+    """
 
-    def __init__(self):  # pylint: disable = R0914, R0915
+    def __init__(self, db_path=DBPATH):  # pylint: disable = R0914, R0915
         super().__init__()
         self.setGeometry(100, 100, 800, 800)
         self.setWindowTitle("SOI-tool")
         self.statusBar()
 
         # Database instance
-        self.database = Database()
-
+        self.database = Database(db_path)
         # Timer for automatic update of codes in CodeBook
         self.timer = QTimer()
         # Interval i set to msec since last 24h update
@@ -111,14 +112,16 @@ class MainWindow(QMainWindow):
         # Export full codebook
         export_codebook_full = QAction("Stor kodebok", self)
         export_codebook_full.setStatusTip("Eksporter stor kodebok som PDF")
-        export_codebook_full.triggered.connect(generate_codebook_pdf)
+        export_codebook_full.triggered.connect(
+            partial(generate_codebook_pdf, database=self.database)
+        )
         export_codebook.addAction(export_codebook_full)
 
         # Export small codebook
         export_codebook_small = QAction("Liten kodebok", self)
         export_codebook_small.setStatusTip("Eksporter liten kodebok som PDF")
         export_codebook_small.triggered.connect(
-            partial(generate_codebook_pdf, small=True)
+            partial(generate_codebook_pdf, database=self.database, small=True)
         )
         export_codebook.addAction(export_codebook_small)
 
@@ -194,10 +197,6 @@ class MainWindow(QMainWindow):
 
 if __name__ == "__main__":
 
-    # Create and set up database if it does not exist
-    if not os.path.exists(DBPATH):
-        Database()
-
     app = QApplication(sys.argv)
     WINDOW = MainWindow()
     WINDOW.showMaximized()
diff --git a/soitool/setup_settings.py b/soitool/setup_settings.py
index 1f23448163ae9224e83db8ac1d9ffbecb4fcd7e4..9e19b468cea539fc23027de3799ee1a50fa6b646 100644
--- a/soitool/setup_settings.py
+++ b/soitool/setup_settings.py
@@ -13,81 +13,236 @@ from PySide2.QtWidgets import (
     QLineEdit,
     QRadioButton,
     QPushButton,
+    QComboBox,
+    QGroupBox,
 )
 
 
 class Setup(QDialog):  # pylint: disable = R0902
-    """Contains the settings for the SOI."""
-
-    def __init__(self):  # pylint: disable = R0915
+    """Contains the settings for the SOI.
+
+    This class is used to change the settings for the SOI.
+    There are 4 different settings-groups; headerdata, orientation, placement
+    and algorithm. In headerdata you can change the text that appears in the
+    header of the SOI. Orientation is whether you want the SOI in landscape or
+    portrait. Placement is if you want to move the modules yourself or let the
+    program do it. And algorithm is which algorithms should be used to place
+    the modules on the SOI.
+
+    Parameters
+    ----------
+    soi : soitool.soi.SOI
+        The SOI-instance to change
+    """
+
+    def __init__(self, soi):  # pylint: disable = R0915
         super().__init__()
+
+        self.soi = soi
+
+        # layouts
         self.layout_setup = QVBoxLayout()
         self.layout_buttons = QHBoxLayout()
         self.layout_header = QFormLayout()
-        self.layout_paper_orientation = QFormLayout()
-        self.layout_algorithm = QFormLayout()
-        self.layout_module_placement = QFormLayout()
-
-        # Labels for headings
-        self.label_setup = QLabel("Oppsett")
-        # setup.setStyleSheet("font: 12pt")
+        self.layout_orientation_button = QVBoxLayout()
+        self.layout_alg_button_bin = QVBoxLayout()
+        self.layout_alg_button_pack = QVBoxLayout()
+        self.layout_alg_button_sort = QVBoxLayout()
+        self.layout_placement_button = QVBoxLayout()
+
+        # groupbox for radiobuttons
+        self.group_orientation = QGroupBox()
+        self.group_placement = QGroupBox()
+        self.group_algorithm_bin = QGroupBox()
+        self.group_algorithm_pack = QGroupBox()
+        self.group_algorithm_sort = QGroupBox()
+
+        # labels for mainheadings
         self.label_header = QLabel("Headerdata")
         self.label_paper_orientation = QLabel("Papirretning")
-        self.label_algorithm = QLabel("Plasseringsalgoritme")
+        self.label_algorithm = QLabel("Plasseringsalgoritmer")
         self.label_module_placement = QLabel("Modulplassering")
 
-        self.layout_setup.addWidget(self.label_setup)
-
-        # Headerdata
+        # headerdata
         self.layout_setup.addWidget(self.label_header)
-        self.head1 = QLabel("Header1")  # Change variablename later
-        self.head2 = QLabel("Header2")  # Change variablename later
-        self.hline1 = QLineEdit()  # Change variablename later
-        self.hline2 = QLineEdit()  # Change variablename later
-        self.layout_header.addRow(self.head1, self.hline1)
-        self.layout_header.addRow(self.head2, self.hline2)
+        self.label_title = QLabel("Tittel:")
+        self.label_description = QLabel("Beskrivelse:")
+        self.label_version = QLabel("Versjon:")
+        self.label_date = QLabel("Dato:")
+        self.label_valid_from = QLabel("Gyldig fra:")
+        self.label_valid_to = QLabel("Gyldig til:")
+        self.label_classification = QLabel("Klassifisering")
+
+        self.edit_title = QLineEdit()
+        self.edit_description = QLineEdit()
+        self.edit_version = QLineEdit()
+        self.edit_date = QLineEdit()
+        self.edit_valid_from = QLineEdit()
+        self.edit_valid_to = QLineEdit()
+
+        self.edit_classification = QComboBox()
+        self.edit_classification.addItem("UGRADERT")
+        self.edit_classification.addItem("BEGRENSET")
+        self.edit_classification.addItem("KONFIDENSIELT")
+        self.edit_classification.addItem("HEMMELIG")
+        self.edit_classification.addItem("STRENGT HEMMELIG")
+
+        self.layout_header.addRow(self.label_title, self.edit_title)
+        self.layout_header.addRow(
+            self.label_description, self.edit_description
+        )
+        self.layout_header.addRow(self.label_version, self.edit_version)
+        self.layout_header.addRow(self.label_date, self.edit_date)
+        self.layout_header.addRow(self.label_valid_from, self.edit_valid_from)
+        self.layout_header.addRow(self.label_valid_to, self.edit_valid_to)
+        self.layout_header.addRow(
+            self.label_classification, self.edit_classification
+        )
         self.layout_setup.addLayout(self.layout_header)
 
-        # Paperorientation
+        # paperorientation
         self.layout_setup.addWidget(self.label_paper_orientation)
-        self.pob1 = QRadioButton()  # Change variablename later
-        self.pob2 = QRadioButton()  # Change variablename later
-        self.layout_paper_orientation.addRow(self.pob1, QLabel("Horisontal"))
-        self.layout_paper_orientation.addRow(self.pob2, QLabel("Vertikal"))
-        self.layout_setup.addLayout(self.layout_paper_orientation)
-
-        # Placement algorithm
-        self.layout_setup.addWidget(self.label_algorithm)
-        self.pb1 = QRadioButton()  # Change variablename later
-        self.pb2 = QRadioButton()  # Change variablename later
-        self.pb3 = QRadioButton()  # Change variablename later
-        self.pb4 = QRadioButton()  # Change variablename later
-        self.layout_algorithm.addRow(self.pb1, QLabel("Alg1"))
-        self.layout_algorithm.addRow(self.pb2, QLabel("Alg2"))
-        self.layout_algorithm.addRow(self.pb3, QLabel("Alg3"))
-        self.layout_algorithm.addRow(self.pb4, QLabel("Alg4"))
-        self.layout_setup.addLayout(self.layout_algorithm)
-
-        # Moduleplacement
+        self.rbutton_landscape = QRadioButton("Horisontal")
+        self.rbutton_portrait = QRadioButton("Vertikal")
+        self.layout_orientation_button.addWidget(self.rbutton_landscape)
+        self.layout_orientation_button.addWidget(self.rbutton_portrait)
+        self.group_orientation.setLayout(self.layout_orientation_button)
+        self.layout_setup.addWidget(self.group_orientation)
+
+        # moduleplacement
         self.layout_setup.addWidget(self.label_module_placement)
-        self.mb1 = QRadioButton()  # Change variablename later
-        self.mb2 = QRadioButton()  # Change variablename later
-        self.layout_module_placement.addRow(self.mb1, QLabel("Automatisk"))
-        self.layout_module_placement.addRow(self.mb2, QLabel("Manuelt"))
-        self.layout_setup.addLayout(self.layout_module_placement)
-
-        # Exit-buttons
-        self.button_cancel = QPushButton("Avbryt")
+        self.rbutton_auto = QRadioButton("Automatisk")
+        self.rbutton_manual = QRadioButton("Manuelt")
+        self.layout_placement_button.addWidget(self.rbutton_auto)
+        self.layout_placement_button.addWidget(self.rbutton_manual)
+        self.group_placement.setLayout(self.layout_placement_button)
+        self.layout_setup.addWidget(self.group_placement)
+
+        # placement algorithm
+        self.layout_setup.addWidget(self.label_algorithm)
+        self.rbutton_bin1 = QRadioButton("BFF")
+        self.rbutton_bin2 = QRadioButton("BBF")
+        self.rbutton_pack1 = QRadioButton("MaxRectsBI")
+        self.rbutton_pack2 = QRadioButton("SkylinBl")
+        self.rbutton_pack3 = QRadioButton("GuillotineBssfSas")
+        self.rbutton_sort1 = QRadioButton("none")
+        self.rbutton_sort2 = QRadioButton("area")
+        self.rbutton_sort3 = QRadioButton("width")
+        self.rbutton_sort4 = QRadioButton("height")
+
+        self.layout_alg_button_bin.addWidget(QLabel("Bin"))
+        self.layout_alg_button_bin.addWidget(self.rbutton_bin1)
+        self.layout_alg_button_bin.addWidget(self.rbutton_bin2)
+        self.layout_alg_button_pack.addWidget(QLabel("Pack"))
+        self.layout_alg_button_pack.addWidget(self.rbutton_pack1)
+        self.layout_alg_button_pack.addWidget(self.rbutton_pack2)
+        self.layout_alg_button_pack.addWidget(self.rbutton_pack3)
+        self.layout_alg_button_sort.addWidget(QLabel("Sort"))
+        self.layout_alg_button_sort.addWidget(self.rbutton_sort1)
+        self.layout_alg_button_sort.addWidget(self.rbutton_sort2)
+        self.layout_alg_button_sort.addWidget(self.rbutton_sort3)
+        self.layout_alg_button_sort.addWidget(self.rbutton_sort4)
+
+        self.group_algorithm_bin.setLayout(self.layout_alg_button_bin)
+        self.group_algorithm_pack.setLayout(self.layout_alg_button_pack)
+        self.group_algorithm_sort.setLayout(self.layout_alg_button_sort)
+
+        self.layout_setup.addWidget(self.group_algorithm_bin)
+        self.layout_setup.addWidget(self.group_algorithm_pack)
+        self.layout_setup.addWidget(self.group_algorithm_sort)
+
+        # save and cancel
         self.button_save = QPushButton("Lagre")
-        self.layout_buttons.addWidget(self.button_cancel)
+        self.button_cancel = QPushButton("Avbryt")
         self.layout_buttons.addWidget(self.button_save)
+        self.layout_buttons.addWidget(self.button_cancel)
         self.layout_setup.addLayout(self.layout_buttons)
 
         self.setLayout(self.layout_setup)
 
-        self.button_cancel.clicked.connect(self.reject)  # esc-key (default)
-        self.button_save.clicked.connect(self.accept)  # enter-key (default)
-
-    # need two functions, save and cancel
-    # when cancel, clear lineedits and set radiobuttons to default or SOI-parts
-    # when save, lineedits writes to labels and find a way to get radiobuttons
+        self.button_cancel.clicked.connect(self.cancel)  # esc-key (default)
+        self.button_save.clicked.connect(self.save)  # enter-key (default)
+
+    def cancel(self):
+        """Close the dialog without saving."""
+        self.reject()
+
+    def save(self):
+        """Save and update the SOI with the given changes."""
+        self.soi.title = self.edit_title.text()
+        self.soi.description = self.edit_description.text()
+        self.soi.version = self.edit_version.text()
+        self.soi.date = self.edit_date.text()
+        self.soi.valid_from = self.edit_valid_from.text()
+        self.soi.valid_to = self.edit_valid_to.text()
+        self.soi.classification = (
+            self.edit_classification.currentText().lower()
+        )
+
+        # find which radiobutton that is checked
+        if self.rbutton_landscape.isChecked():
+            self.soi.orientation = "landscape"
+        else:
+            self.soi.orientation = "portrait"
+
+        if self.rbutton_auto.isChecked():
+            self.soi.placement_strategy = "auto"
+        else:
+            self.soi.placement_strategy = "manual"
+
+        # loop through groupbox to find checked radiobuttons
+        for i in self.group_algorithm_bin.findChildren(QRadioButton):
+            if i.isChecked():
+                self.soi.algorithm_bin = i.text()
+                break
+
+        for i in self.group_algorithm_pack.findChildren(QRadioButton):
+            if i.isChecked():
+                self.soi.algorithm_pack = i.text()
+                break
+
+        for i in self.group_algorithm_sort.findChildren(QRadioButton):
+            if i.isChecked():
+                self.soi.algorithm_sort = i.text()
+                break
+
+        self.accept()
+
+    def get_from_soi(self):
+        """Get data from the SOI and update the dialog with the data."""
+        self.edit_title.setText(self.soi.title)
+        self.edit_description.setText(self.soi.description)
+        self.edit_version.setText(self.soi.version)
+        self.edit_date.setText(self.soi.date)
+        self.edit_valid_from.setText(self.soi.valid_from)
+        self.edit_valid_to.setText(self.soi.valid_to)
+        self.edit_classification.setCurrentText(
+            self.soi.classification.upper()
+        )
+
+        # check radiobuttons according to current SOI settings
+        if self.soi.orientation == "landscape":
+            self.rbutton_landscape.setChecked(True)
+        else:
+            self.rbutton_portrait.setChecked(True)
+
+        if self.soi.placement_strategy == "auto":
+            self.rbutton_auto.setChecked(True)
+        else:
+            self.rbutton_manual.setChecked(True)
+
+        # loops through the groupbox to find children that are radiobuttons
+        for i in self.group_algorithm_bin.findChildren(QRadioButton):
+            if i.text() == self.soi.algorithm_bin:
+                i.setChecked(True)
+                break
+
+        for i in self.group_algorithm_pack.findChildren(QRadioButton):
+            if i.text() == self.soi.algorithm_pack:
+                i.setChecked(True)
+                break
+
+        for i in self.group_algorithm_sort.findChildren(QRadioButton):
+            if i.text() == self.soi.algorithm_sort:
+                i.setChecked(True)
+                break
diff --git a/soitool/soi_workspace_widget.py b/soitool/soi_workspace_widget.py
index d2c929d84443a27ed08ff11a475de7d472d53ac1..86daf0ac79694576de20f4e0f02a1b9e9ef4ec7f 100644
--- a/soitool/soi_workspace_widget.py
+++ b/soitool/soi_workspace_widget.py
@@ -11,6 +11,7 @@ from PySide2.QtWidgets import (
     QLabel,
     QDialog,
 )
+from PySide2 import QtCore
 from soitool.soi import SOI, ModuleType, ModuleNameTaken
 from soitool.module_list import ModuleList
 from soitool.inline_editable_soi_view import InlineEditableSOIView
@@ -30,6 +31,7 @@ class SOIWorkspaceWidget(QWidget):
         super().__init__()
 
         self.soi = SOI()
+        self.popup = Setup(self.soi)
 
         self.layout_wrapper = QHBoxLayout()
         self.layout_sidebar = QVBoxLayout()
@@ -39,6 +41,7 @@ class SOIWorkspaceWidget(QWidget):
         self.button_new_module.setShortcut("Ctrl+m")
         self.button_new_module.setStatusTip("Legg til en ny modul")
         self.button_setup = QPushButton("Oppsett")
+        self.button_setup.setStatusTip("Endre oppsett på SOI")
 
         self.list_modules = ModuleList(ModuleType.MAIN_MODULE, self)
         self.list_attachments = ModuleList(ModuleType.ATTACHMENT_MODULE, self)
@@ -46,7 +49,7 @@ class SOIWorkspaceWidget(QWidget):
         self.view = InlineEditableSOIView(self.soi)
         self.widget_sidebar = QWidget()
         self.widget_sidebar.setFixedWidth(200)
-        self.popup = Setup()
+        self.popup.setWindowTitle("Oppsett")
 
         # build layouts
         self.layout_sidebar.addWidget(QLabel("Moduler:"))
@@ -66,13 +69,18 @@ class SOIWorkspaceWidget(QWidget):
 
     def open_setup(self):
         """Open setup_settings."""
-        self.popup.setGeometry(150, 150, 200, 200)
-        self.popup.exec()  # exec = modal dialog, show = modeless dialog
+        self.popup.resize(300, 300)
+        self.popup.setWindowFlag(QtCore.Qt.WindowContextHelpButtonHint, False)
+        self.popup.get_from_soi()
+        self.popup.exec()
 
     def new_module(self):
         """Add new module to SOI using new_module dialog."""
         new_module_dialog = NewModuleDialog()
         new_module_dialog.resize(350, 350)
+        new_module_dialog.setWindowFlag(
+            QtCore.Qt.WindowContextHelpButtonHint, False
+        )
         dialogcode = new_module_dialog.exec()
 
         if dialogcode == QDialog.DialogCode.Accepted:
diff --git a/test/test_codebook_to_pdf.py b/test/test_codebook_to_pdf.py
index 5aa94bee06349f604c97f6065d7c10d0dc8112ab..5f4fe854723c35e9792fe5eee3819bf87a9070e6 100644
--- a/test/test_codebook_to_pdf.py
+++ b/test/test_codebook_to_pdf.py
@@ -5,6 +5,11 @@ from functools import partial
 from pathlib import Path
 from datetime import datetime
 from soitool import codebook_to_pdf
+from soitool.database import Database
+
+TESTDBNAME = "testDatabase"
+SOITOOL_DIR = Path(__file__).parent.parent / "soitool"
+TESTDBPATH = os.path.join(SOITOOL_DIR, TESTDBNAME)
 
 SOITOOL_ROOT_PATH = Path(__file__).parent.parent
 
@@ -29,15 +34,17 @@ class ExportTest(unittest.TestCase):
 
     def test_generate_codebook_pdf(self):
         """Test generated PDF-file exist."""
+        database = Database(TESTDBPATH)
+
         # Test full codebook (default)
-        codebook_to_pdf.generate_codebook_pdf()
+        codebook_to_pdf.generate_codebook_pdf(database=database)
         file_name = codebook_to_pdf.generate_filename(small=False)
         file_path_full = os.path.join(SOITOOL_ROOT_PATH, file_name)
         # Assert file exists
         self.assertTrue(os.path.exists(file_path_full))
 
         # Test small codebook
-        codebook_to_pdf.generate_codebook_pdf(small=True)
+        codebook_to_pdf.generate_codebook_pdf(database=database, small=True)
         file_name = codebook_to_pdf.generate_filename(small=True)
         file_path_small = os.path.join(SOITOOL_ROOT_PATH, file_name)
         # Assert file exists
@@ -54,3 +61,5 @@ def delete_generated_files(file_path1, file_path2):
         os.remove(file_path1)
     if os.path.exists(file_path2):
         os.remove(file_path2)
+    if os.path.exists(TESTDBPATH):
+        os.remove(TESTDBPATH)
diff --git a/test/test_database.py b/test/test_database.py
index 890b3375b7c9ea329e391957732bda32a0ce692a..c9a6598e63977ff4e3fa145ee2a00d63e4757cb9 100644
--- a/test/test_database.py
+++ b/test/test_database.py
@@ -5,9 +5,13 @@ import unittest
 import json
 from time import sleep
 from datetime import datetime
-from soitool.database import Database, DBPATH
+from soitool.database import Database
 from soitool.coder import get_code_length_needed
 
+TESTDBNAME = "testDatabase"
+SOITOOL_DIR = Path(__file__).parent.parent / "soitool"
+TESTDBPATH = os.path.join(SOITOOL_DIR, TESTDBNAME)
+
 TESTDATA_PATH = Path(__file__).parent.parent / "soitool/testdata"
 
 
@@ -16,7 +20,7 @@ class DatabaseTest(unittest.TestCase):
 
     def setUp(self):
         """Connect to/create database."""
-        self.database = Database()
+        self.database = Database(db_path=TESTDBPATH)
         self.addCleanup(self.delete_db)
 
     def test_connection(self):
@@ -290,10 +294,10 @@ class DatabaseTest(unittest.TestCase):
         self.assertRegex(code, "[A-Z0-9]")
 
     def delete_db(self):
-        """Delete generated db-file."""
+        """Delete generated database-file."""
         del self.database
-        if os.path.exists(DBPATH):
-            os.remove(DBPATH)
+        if os.path.exists(TESTDBPATH):
+            os.remove(TESTDBPATH)
 
 
 if __name__ == "__main__":
diff --git a/test/test_main_window.py b/test/test_main_window.py
index 894f10cfe69f9b803ad1bb558db9d559f5ed1de8..dc6691d86bf8df1c21785ac7c09601378e6ebc62 100644
--- a/test/test_main_window.py
+++ b/test/test_main_window.py
@@ -1,6 +1,7 @@
 """Test main_window.py."""
-
+import os
 import unittest
+from test.test_database import TESTDBPATH
 from PySide2 import QtWidgets, QtGui
 from soitool import main_window
 
@@ -15,7 +16,8 @@ class TestMainWindow(unittest.TestCase):
 
     def setUp(self):
         """Set up main_window_widget for testing."""
-        self.test_mw = main_window.MainWindow()
+        self.test_mw = main_window.MainWindow(db_path=TESTDBPATH)
+        self.addCleanup(self.delete_db)
 
     def test_window_title(self):
         """Test window title is correct."""
@@ -30,6 +32,13 @@ class TestMainWindow(unittest.TestCase):
         actual = self.test_mw.tabs.currentWidget().button_new_module.text()
         self.assertEqual(expected, actual)
 
+    def delete_db(self):
+        """Delete generated 'testDatabase'-file."""
+        del self.test_mw.timer
+        del self.test_mw
+        if os.path.exists(TESTDBPATH):
+            os.remove(TESTDBPATH)
+
 
 if __name__ == "__main__":
     unittest.main()