diff --git a/binarycpython/tests/test_run_system_wrapper.py b/binarycpython/tests/test_run_system_wrapper.py
index 66bfbc41ab68baae3ea9bbf3ba662d7fd885134c..5b9a9ed64bf9e7d272f82108b9d7c9ec83cee0f3 100644
--- a/binarycpython/tests/test_run_system_wrapper.py
+++ b/binarycpython/tests/test_run_system_wrapper.py
@@ -6,7 +6,7 @@ Unittests for run_system_wrapper
 
 import unittest
 
-from binarycpython.utils.run_system_wrapper import run_system
+# from binarycpython.utils.run_system_wrapper import run_system
 
 if __name__ == "__main__":
     unittest.main()
diff --git a/binarycpython/tests/tests_population_extensions/test_spacing_functions.py b/binarycpython/tests/tests_population_extensions/test_spacing_functions.py
index fde032de0b7dd0f8be4926ce54253984d41a9d01..430c97fe185683f4fc03079d69bf5f21546dfabf 100644
--- a/binarycpython/tests/tests_population_extensions/test_spacing_functions.py
+++ b/binarycpython/tests/tests_population_extensions/test_spacing_functions.py
@@ -10,12 +10,21 @@ TODO: gaussian_zoom
 TODO: const_dt
 """
 
+import os
+import shutil
 import unittest
 
 import numpy as np
 
-from binarycpython.utils.functions import Capturing
-from binarycpython.utils.spacing_functions import const
+from binarycpython.utils.functions import Capturing, temp_dir
+from binarycpython.utils.population_class import Population
+
+
+TMP_DIR = temp_dir("tests", "test_spacing_functions")
+
+shutil.rmtree(TMP_DIR)
+os.makedirs(TMP_DIR, exist_ok=True)
+distribution_functions_pop = Population()
 
 
 class test_spacing_functions(unittest.TestCase):
@@ -24,7 +33,7 @@ class test_spacing_functions(unittest.TestCase):
     """
 
     def test_const(self):
-        with Capturing() as output:
+        with Capturing() as _:
             self._test_const()
 
     def _test_const(self):
@@ -32,10 +41,9 @@ class test_spacing_functions(unittest.TestCase):
         Unittest for function const
         """
 
-        const_return = const(1, 10, 10)
+        const_return = distribution_functions_pop.const_linear(1, 10, 10)
         self.assertTrue(
             (const_return == np.linspace(1, 10, 10 + 1)).all(),
-            msg="Output didn't contain SINGLE_STAR_LIFETIME",
         )
 
 
diff --git a/binarycpython/utils/dicts.py b/binarycpython/utils/dicts.py
index 89c0e63a00afd318ead3b3af9997d864165d63f5..a76ae7c2670f045336515bf8bb366426b524452b 100644
--- a/binarycpython/utils/dicts.py
+++ b/binarycpython/utils/dicts.py
@@ -516,14 +516,14 @@ def merge_dicts(dict_1: dict, dict_2: dict) -> dict:
                     new_dict[key] = dict_2[key]
                 except:
                     msg = f"{key}: Failed to set from {dict_2[key]} when other key was of NoneType "
-                    raise ValueError(msg) from e
+                    raise ValueError(msg)
 
             elif dict_1[key] is None:
                 try:
                     new_dict[key] = dict_1[key]
                 except:
                     msg = f"{key}: Failed to set from {dict_1[key]} when other key was of NoneType "
-                    raise ValueError(msg) from e
+                    raise ValueError(msg)
 
             # string-int clash : convert both to ints and save
             elif (
diff --git a/binarycpython/utils/plot_functions.py b/binarycpython/utils/plot_functions.py
index 6cd505772466b5838adb808acf0305c025dc48f7..60a9dce0f6bbaa80b7ca6b05ec4831629f8827c3 100644
--- a/binarycpython/utils/plot_functions.py
+++ b/binarycpython/utils/plot_functions.py
@@ -21,7 +21,6 @@ Tasks
     TODO: This module is not finished yet.
     TODO: Make modules for single system
     TODO: Put all the plotting functions in here
-
 """
 
 import math
@@ -579,10 +578,10 @@ def plot_system(plot_type, **kwargs):
             "parse_function": parse_function_hr_diagram,
         },
     }
-    plot_system_specific_keywords = ["plot_type", "show_plot", "show_stellar_types"]
+    # plot_system_specific_keywords = ["plot_type", "show_plot", "show_stellar_types"]
 
     # First check on the plot_type input
-    if not plot_type in plot_types_dict:
+    if plot_type not in plot_types_dict:
         print(
             "Warning, the provided plot type is not known. \
             Please choose one from the following:\n\t{}".format(
diff --git a/binarycpython/utils/population_extensions/cache.py b/binarycpython/utils/population_extensions/cache.py
index fe61163b7a5895c8d8e32924ac10be7e5094e3b8..eeb17c5bec5cde7a8cdd5fc6118f436b260f5f34 100644
--- a/binarycpython/utils/population_extensions/cache.py
+++ b/binarycpython/utils/population_extensions/cache.py
@@ -146,7 +146,7 @@ class cache:
             # detect if the function is already wrapped
             x = func.split(".")
             modulename = "binarycpython.utils.population_extensions." + x[0]
-            module = importlib.import_module(modulename)
+            # module = importlib.import_module(modulename)
             _method = eval(
                 "module.{}.{}".format(x[0], x[1])
             )  # TODO: we can do this differently with some .get call instead of eval
@@ -247,7 +247,7 @@ class cache:
                 # TODO: Make this part better: needs to be able to handle any depth
                 x = func.split(".")
                 modulename = "binarycpython.utils.population_extensions." + x[0]
-                module = importlib.import_module(modulename)
+                # module = importlib.import_module(modulename)
                 _method = eval("module.{}.{}".format(x[0], x[1]))
 
                 if testargs:
diff --git a/binarycpython/utils/population_extensions/ensemble.py b/binarycpython/utils/population_extensions/ensemble.py
index ae8de1ce5cefa9bc5a9a8a6451b0e3eb497b7ea4..ad1a8edcca0a6d1d10389e01951cc75be0511761 100644
--- a/binarycpython/utils/population_extensions/ensemble.py
+++ b/binarycpython/utils/population_extensions/ensemble.py
@@ -49,7 +49,7 @@ class ensemble:
                 0,
             )
 
-        if self.grid_options["combine_ensemble_with_thread_joining"] == False:
+        if not self.grid_options["combine_ensemble_with_thread_joining"]:
             if not self.custom_options.get("data_dir", None):
                 self.verbose_print(
                     "Error: chosen to write the ensemble output directly to files but data_dir isn't set",
diff --git a/binarycpython/utils/population_extensions/grid_logging.py b/binarycpython/utils/population_extensions/grid_logging.py
index c629dac043eeb5762729f0ad45686d48886b77a6..154657fdd64bf986d1a743561df30748d25dfa0e 100644
--- a/binarycpython/utils/population_extensions/grid_logging.py
+++ b/binarycpython/utils/population_extensions/grid_logging.py
@@ -11,7 +11,6 @@ import time
 
 import strip_ansi
 
-import binarycpython.utils.functions
 from binarycpython.utils.custom_logging_functions import (
     autogen_C_logging_code,
     binary_c_log_code,
@@ -367,8 +366,8 @@ class grid_logging:
 
         # make a list of strings
         if separator:
-            for l in stringlist:
-                strings += l.split(sep=separator)
+            for string in stringlist:
+                strings += string.split(sep=separator)
         else:
             strings = stringlist
 
diff --git a/binarycpython/utils/population_extensions/grid_options_defaults.py b/binarycpython/utils/population_extensions/grid_options_defaults.py
index 14beda565b36b4e73a73a748ef798557c362e36c..75e2485ad28db3cda395a502a01acd7878df3641 100644
--- a/binarycpython/utils/population_extensions/grid_options_defaults.py
+++ b/binarycpython/utils/population_extensions/grid_options_defaults.py
@@ -628,6 +628,6 @@ class grid_options_defaults:
             os.path.join(os.environ.get("HOME", error_string), ".cache", "binary_c"),
             os.path.join(os.environ.get("TMP", error_string), "cache"),
         ]:
-            if not error_string in path and os.path.isdir(path):
+            if error_string not in path and os.path.isdir(path):
                 return path
         return None
diff --git a/binarycpython/utils/population_extensions/termination_functions.py b/binarycpython/utils/population_extensions/termination_functions.py
index 6006b14fae96ae81c85c321813f8a10921c3effa..9881685a517cede4775f3bd7d1d5b49502768cf3 100644
--- a/binarycpython/utils/population_extensions/termination_functions.py
+++ b/binarycpython/utils/population_extensions/termination_functions.py
@@ -7,9 +7,6 @@ Main script to provide the termination functions class extensions
 import sys
 import traceback
 
-from binarycpython import _binary_c_bindings
-from binarycpython.utils.ensemble import extract_ensemble_json_from_string
-
 
 class termination_functions:
     """
diff --git a/binarycpython/utils/run_system_wrapper.py b/binarycpython/utils/run_system_wrapper.py
index 348c82360e61875743fd3b7799eef6b633905f20..f5334b114176b4d3ba190ba1580d84196cc1bb68 100644
--- a/binarycpython/utils/run_system_wrapper.py
+++ b/binarycpython/utils/run_system_wrapper.py
@@ -74,7 +74,7 @@ def run_system(**kwargs):
 
         # Notify user when this key wont be used
         else:
-            if not key in other_keywords:
+            if key not in other_keywords:
                 print(
                     "The following keyword was not recognised and wont be used:\n\t{}".format(
                         key
diff --git a/setup.py b/setup.py
index a0c829bcf2d3cf8b08d7f62547788b3c4cae23c9..22df3546f07bc9be590b224cd065f2e2a5980352 100644
--- a/setup.py
+++ b/setup.py
@@ -1,15 +1,13 @@
 """
 Setup script for binarycpython
 """
-import distutils.command.build
 import os
 import re
-import subprocess
 import sys
+import subprocess
+import distutils.command.build
 from distutils.core import Extension, setup
 
-import setuptools
-
 #
 this_file = os.path.abspath(__file__)
 this_file_dir = os.path.dirname(this_file)
@@ -21,6 +19,8 @@ REQUIRED_BINARY_C_VERSIONS = ["2.1.7", "2.2pre1", "2.2.0", "2.2.1", "2.2.2"]
 # Defining functionality
 ############################################################
 
+
+
 # Functions
 def version():
     """
@@ -224,6 +224,7 @@ headers = ["src/includes/header.h"]
 # Custom build command
 ############################################################
 
+
 # Override build command
 class CustomBuildCommand(distutils.command.build.build):
     def run(self):
@@ -240,7 +241,6 @@ setup(
     version=version(),
     description="""This is a python API for binary_c (versions {}) by David Hendriks, Rob Izzard and collaborators. Based on the initial set up by Jeff andrews.""".format(
         ",".join(REQUIRED_BINARY_C_VERSIONS),
-        ",".join(REQUIRED_BINARY_C_VERSIONS),
     ),
     author="David Hendriks",
     author_email="davidhendriks93@gmail.com",