diff --git a/README.md b/README.md
index 8b5bbbd078609889117b1bed918296c1fff92c09..98ab80fe34b1093817757a896feb58e43dfbf38f 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
-Python module for binary_c
+# Python module for binary_c
 
-Based on a original work by Jeff Andrews, updated and extended
-for Python3 by Robert Izzard
+Based on a original work by Jeff Andrews (can be found in old_solution/ directory)
+updated and extended for Python3 by Robert Izzard, David hendriks
 
 Warning : THIS CODE IS EXPERIMENTAL!
 
@@ -9,41 +9,42 @@ r.izzard@surrey.ac.uk
 http://personal.ph.surrey.ac.uk/~ri0005/binary_c.html
 09/06/2019
 
-------------------------------------------------------------
-
+Requirements
 ---------------------
+- Python3
+- binary_c version 2.1+
+- requirements.txt (no?)
+
 Environment variables
 ---------------------
-
 Before compilation you should set the following environment variables:
 
-required: BINARY_C should point to the root directory of your binary_c installation
-
-recommended: LD_LIBRARY_PATH should include $BINARY_C/src and whatever directories are required to run binary_c (e.g. locations of libgsl, libmemoize, librinterpolate, etc.)
+- required: `BINARY_C` should point to the root directory of your binary_c installation
+- recommended: `LD_LIBRARY_PATH` should include $BINARY_C/src and whatever directories are required to run binary_c (e.g. locations of libgsl, libmemoize, librinterpolate, etc.)
+- recommended: `LIBRARY_PATH` should include whatever directories are required to build binary_c (e.g. locations of libgsl, libmemoize, librinterpolate, etc.)
 
-recommended: LIBRARY_PATH should include whatever directories are required to build binary_c (e.g. locations of libgsl, libmemoize, librinterpolate, etc.)
-
-
-
----------------------
 Build instructions
 ---------------------
-
-To build the module, make sure you have built binary_c (with "make" in the binar_c root directory), its shared library (with "make libbinary_c.so" in the binary_c root directory), and set environment variables as described above, then run:
-
----
+To build the module, make sure you have built binary_c (with `make` in the binary_c root directory), its shared library (with `make libbinary_c.so` in the binary_c root directory), and set environment variables as described above, then run the following code in t:
+```
  make clean
  make
----
+```
+Then to test the Python module:
 
-then to test the Python module
-
----
+```
  python3 ./python_API_test.py
----
-
-
+```
 You will require whatever libraries with which binary_c was compiled, as well as the compiler with which Python was built (usually gcc, which is easily installed on most systems).
 
+If you want to be able to import the binary_c module correctly for child directories (or anywhere for that matter), execute or put the following code in your .bashrc/.zshrc: 
+```
+export LD_LIBRARY_PATH=<full path to directory containing libbinary_c_api.so>:$LD_LIBRARY_PATH
+export PYTHONPATH=<full path to directory containing libbinary_c_api.so>:$PYTHONPATH
+```
+
+Usage notes
+---------------------
+When running a jupyter notebook and importing binary_c, it might happen that the module binary_c cannot be found. I experienced this when I executed Jupyter Notebook from a virtual environment which didnt use the same python (version/binary/shim) as the one I built this library with. Make sure jupyter does use the same underlying python version/binary/shim. That resolved the issue for me.
 
-------------------------------------------------------------
+Also: I figured that having binaryc output the log like "<LOG HEADER> t=10e4 ..." (i.e. printing the parameter names as well as their values) would be useful because in that way one can easily have python read that out automatically instead of having to manually copy the list of parameter names.
diff --git a/__init__.py b/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/binary_c_api.c b/binary_c_api.c
deleted file mode 100644
index 487b3989e388353f0ee705bee5477765a99f4f22..0000000000000000000000000000000000000000
--- a/binary_c_api.c
+++ /dev/null
@@ -1,125 +0,0 @@
-#include "binary_c_python.h"
-//#include "binary_c_api.h"
-#include "binary_c_API.h"
-#include "binary_c_API_prototypes.h"
-#include <time.h>
-#include <sys/timeb.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-
-/*
- * apitest
- *
- * Short test programme to throw random binary systems at binary_c's
- * library via its API.
- *
- * Note that it looks more complicated than it is because I have included
- * code to capture binary_c's stdout stream and output it here.
- *
- * This code sends output to stderr : you should use apitest.sh to run it
- * and hence force output to your terminal's stdout.
- *
- * Output lines:
- *
- * APITEST ....  is information about what this code is doing.
- * STATUS  ....  is information about the binary system.
- * BINARY_C .... is output from binary_c (see iterate_logging.c etc.)
- *               which would have gone to stdout
- *
- * If you define the NO_OUTPUT macro, there will be no output except
- * the memory allocation and test system information. This is useful for speed tests,
- * but note that you may end up in a race condition where the pipe which replaces
- * stdout's buffer fills and hence the code stops.
- *
- * Note:
- * I have tested this with gcc 4.7.2 (Ubuntu 12.10) only.
- */
-
-
-// #define _CAPTURE
-#ifdef _CAPTURE
-static void show_stdout(void);
-static void capture_stdout(void);
-#endif
-
-
-/* global variables */
-int out_pipe[2];
-int stdoutwas;
-
-int main(int argc,
-         char * argv[])
-{
-    char * argstring = MALLOC(sizeof(char) * (size_t)STRING_LENGTH);
-    snprintf(argstring,
-             STRING_LENGTH,
-             "binary_c M_1 %g M_2 %g separation %g orbital_period %g metallicity %g max_evolution_time %g\n",
-             20.0,
-             15.0,
-             0.0,
-             3.0,
-             0.02,
-             15000.0);
-
-    char * buffer ;
-    size_t nbytes;
-    int out = run_binary(argstring,
-                     &buffer,
-                     &nbytes);
-
-    printf("output (binary_c returned %d)\n%s\n",out,buffer);
-
-    free(buffer);
-    
-    return out;
-}
-
-
-int run_binary(char * argstring,
-               char ** buffer,
-               size_t * nbytes)
-{
-    /* memory for N binary systems */
-    struct libbinary_c_stardata_t *stardata;
-    struct libbinary_c_store_t * store = NULL;
-
-    printf("argstring : %s\n",argstring);
-    fflush(stdout);
-
-    stardata = NULL;
-    binary_c_new_system(&stardata,
-                        NULL,
-                        NULL,
-                        &store,
-                        &argstring,
-                        -1);
-    snprintf(stardata->preferences->log_filename,
-             STRING_LENGTH-1,
-             "%s",
-             "/dev/null");
-    snprintf(stardata->preferences->api_log_filename_prefix,
-             STRING_LENGTH-1,
-             "%s",
-             "/dev/null");
-    stardata->preferences->internal_buffering = 2;
-    stardata->preferences->batchmode = BATCHMODE_LIBRARY;
-
-    binary_c_evolve_for_dt(stardata,
-                           stardata->model.max_evolution_time);
-
-    /*
-     * Save the buffer pointer
-     */
-    binary_c_buffer_info(stardata,&buffer,nbytes);
-
-    /*
-     * And free everything else
-     */    
-    binary_c_free_memory(&stardata,TRUE,TRUE,FALSE);
-    binary_c_free_store_contents(store);
-    
-    return 0;
-}
diff --git a/binary_c_api.h b/binary_c_api.h
deleted file mode 100644
index ef9f2ccdbb9d5f28b9d822d12ec7a9da432af606..0000000000000000000000000000000000000000
--- a/binary_c_api.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#pragma once
-#ifndef BINARY_C_PYTHON_API_H
-#define BINARY_C_PYTHON_API_H
-
-/* local function prototypes */
-static void APIprintf(char * format,...);
-
-int run_binary(char * argstring,
-               char ** buffer,
-               size_t * nbytes);
-
-/* C macros */
-#define BINARY_C_APITEST_VERSION 0.1
-#define APIprint(...) APIprintf(__VA_ARGS__);
-#define NO_OUTPUT
-
-#endif // BINARY_C_PYTHON_API_H
diff --git a/binary_c_api_python.h b/binary_c_api_python.h
deleted file mode 100644
index ef9f2ccdbb9d5f28b9d822d12ec7a9da432af606..0000000000000000000000000000000000000000
--- a/binary_c_api_python.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#pragma once
-#ifndef BINARY_C_PYTHON_API_H
-#define BINARY_C_PYTHON_API_H
-
-/* local function prototypes */
-static void APIprintf(char * format,...);
-
-int run_binary(char * argstring,
-               char ** buffer,
-               size_t * nbytes);
-
-/* C macros */
-#define BINARY_C_APITEST_VERSION 0.1
-#define APIprint(...) APIprintf(__VA_ARGS__);
-#define NO_OUTPUT
-
-#endif // BINARY_C_PYTHON_API_H
diff --git a/binaryc_python_utils/custom_logging_functions.py b/binaryc_python_utils/custom_logging_functions.py
new file mode 100644
index 0000000000000000000000000000000000000000..bfd3c2f9843da1a2f754af583b4cfeb1e13f5f70
--- /dev/null
+++ b/binaryc_python_utils/custom_logging_functions.py
@@ -0,0 +1,231 @@
+import os
+import textwrap
+import subprocess
+import socket
+
+# Functions for the automatic logging of stuff
+def autogen_C_logging_code(logging_dict):
+    # See example_perl.pm autologging
+    """
+    Function that autogenerates PRINTF statements for binaryc
+
+    Input:
+        dictionary where the key is the header of that logging line and items which are lists of parameters that will be put in that logging line
+
+        example: {'MY_STELLAR_DATA': 
+        [
+            'model.time',
+            'star[0].mass',
+            'model.probability',
+            'model.dt'
+        ']}
+    """
+
+    # Check if the input is of the correct form 
+    if not type(logging_dict)==dict:
+        print("Error: please use a dictionary as input")
+        return None
+
+    code = ''
+    # Loop over dict keys
+    for key in logging_dict:
+        logging_dict_entry = logging_dict[key]
+
+        # Check if item is of correct type:
+        if type(logging_dict_entry)==list:
+
+            # Construct print statement
+            code += 'Printf("{}'.format(key)
+            code += ' {}'.format('%g '*len(logging_dict_entry))
+            code = code.strip()
+            code += '\\n"'
+
+            # Add format keys
+            for param in logging_dict_entry:
+                code += ',((double)stardata->{})'.format(param)
+            code += ');\n'
+
+        else:
+            print('Error: please use a list for the list of parameters that you want to have logged')
+    code = code.strip()
+    # print("MADE AUTO CODE\n\n{}\n\n{}\n\n{}\n".format('*'*60, repr(code), '*'*60))
+
+    return code
+
+####################################################################################
+def binary_c_log_code(code):
+    """
+    Function to construct the code to construct the custom logging function
+    # see example_perl.pm binary_c_log_code in perl
+    """
+    custom_logging_function_string = """\
+#pragma push_macro(\"MAX\")
+#pragma push_macro(\"MIN\")
+#undef MAX
+#undef MIN
+#include \"binary_c.h\"
+
+// add visibility __attribute__ ((visibility ("default"))) to it 
+void binary_c_API_function custom_output_function(struct stardata_t * stardata);
+void binary_c_API_function custom_output_function(struct stardata_t * stardata)
+{{
+    // struct stardata_t * stardata = (struct stardata_t *)x;
+    {};
+}}
+
+#undef MAX 
+#undef MIN
+#pragma pop_macro(\"MIN\")
+#pragma pop_macro(\"MAX\")\
+    """.format(code)
+     
+    # print(repr(textwrap.dedent(custom_logging_function_string)))
+    return textwrap.dedent(custom_logging_function_string)
+
+def binary_c_write_log_code(code, filename):
+    """
+    Function to write the generated logging code to a file
+    """
+
+    cwd = os.getcwd()
+
+    filePath = os.path.join(cwd, filename)
+    if os.path.exists(filePath):
+        try:
+            os.remove(filePath)
+        except:
+            print("Error while deleting file {}".format(filePath))
+
+    with open(filePath, 'w') as f:
+        f.write(code)
+
+def from_binary_c_config(config_file, flag):
+    """
+    Function to run the binaryc_config command with flags
+    """
+
+    res = subprocess.check_output('{config_file} {flag}'.format(config_file=config_file, flag=flag),
+        shell=True, stderr=subprocess.STDOUT)
+
+    # convert and chop off newline
+    res = res.decode('utf').rstrip()
+    return res
+
+def return_compilation_dict():
+    """
+    Function to build the compile command for the shared library
+
+    inspired by binary_c_inline_config command in perl
+
+    TODO: this function still has some cleaning up to do wrt default values for the compile command
+    # https://developers.redhat.com/blog/2018/03/21/compiler-and-linker-flags-gcc/
+
+
+    returns:
+     - string containing the command to build the shared library
+    """    
+
+    # use binary_c-config to get necessary flags
+    BINARY_C_DIR = os.getenv('BINARY_C')
+    if BINARY_C_DIR:
+        BINARY_C_CONFIG = os.path.join(BINARY_C_DIR, 'binary_c-config')
+        BINARY_C_SRC_DIR = os.path.join(BINARY_C_DIR, 'src')
+        # TODO: build in check to see whether the file exists
+    else:
+        raise NameError('Envvar BINARY_C doesnt exist')
+        return None
+
+    # TODO: make more options for the compiling
+    cc = from_binary_c_config(BINARY_C_CONFIG, 'cc')
+
+    # Check for binary_c
+    BINARY_C_EXE = os.path.join(BINARY_C_DIR, 'binary_c')
+    if not os.path.isfile(BINARY_C_EXE):
+        print("We require  binary_c executable; have you built binary_c?")
+        raise NameError('BINARY_C executable doesnt exist')
+
+    # TODO: debug
+    libbinary_c = '-lbinary_c'
+    binclibs = from_binary_c_config(BINARY_C_CONFIG, 'libs')
+    libdirs = "{} -L{}".format(from_binary_c_config(BINARY_C_CONFIG, 'libdirs'), BINARY_C_SRC_DIR)
+    bincflags = from_binary_c_config(BINARY_C_CONFIG, 'cflags')
+    bincincdirs = from_binary_c_config(BINARY_C_CONFIG, 'incdirs')
+
+    # combine 
+    binclibs = ' {} {} {}'.format(libdirs, libbinary_c, binclibs)
+
+    # setup defaults:
+    defaults = {
+        'cc': 'gcc', # default compiler
+        'ccflags': bincflags,
+        'ld': 'ld',         # 'ld': $Config{ld}, # default linker
+        'debug': 0,
+        'inc': '{} -I{}'.format(bincincdirs, BINARY_C_SRC_DIR),
+        # inc => ' '.($Config{inc}//' ').' '.$bincincdirs." -I$srcdir ", # include the defaults plus # GSL and binary_c
+        # 'libname': libname, # libname is usually just binary_c corresponding to libbinary_c.so
+        'libs': binclibs,
+    }
+
+    # set values with defaults. TODO: make other input possile.
+    ld = defaults['ld']
+    debug = defaults['debug']
+    inc = defaults['inc'] # = ($ENV{BINARY_GRID2_INC} // $defaults{inc}).' '.($ENV{BINARY_GRID2_EXTRAINC} // '');
+    libs = defaults['libs'] # = ($ENV{BINARY_GRID2_LIBS} // $defaults{libs}).' '.($ENV{BINARY_GRID2_EXTRALIBS}//'');
+    ccflags = defaults['ccflags'] #  = $ENV{BINARY_GRID2_CCFLAGS} // ($defaults{ccflags}) . ($ENV{BINARY_GRID2_EXTRACCFLAGS} // '');
+  
+    # you must define _SEARCH_H to prevent it being loaded twice
+    ccflags += ' -shared -D_SEARCH_H'
+
+    # remove the visibility=hidden for this compilation
+    ccflags = ccflags.replace('-fvisibility=hidden', '')
+
+
+    # ensure library paths to the front of the libs:
+    libs_content = libs.split(' ')
+    library_paths = [el for el in libs_content if el.startswith('-L')]
+    non_library_paths = [el for el in libs_content if (not el.startswith('-L') and not el=='')]
+    libs = "{} {}".format(' '.join(library_paths), ' '.join(non_library_paths))
+
+    print("Building shared library for custom logging with (binary_c.h) at {} on {}\n".format(BINARY_C_SRC_DIR, socket.gethostname()))
+    print("With options:\n\tcc = {cc}\n\tccflags = {ccflags}\n\tld = {ld}\n\tlibs = {libs}\n\tinc = {inc}\n\n".format(
+        cc=cc, ccflags=ccflags, ld=ld, libs=libs, inc=inc)
+    )
+
+    return {
+        'cc': cc,
+        'ld': ld,
+        'ccflags': ccflags,
+        'libs': libs,
+        'inc': inc
+        }
+
+def compile_shared_lib(code, sourcefile_name, outfile_name):
+    """
+    Function to write the custom logging code to a file and then compile it.
+    """
+
+    # Write code to file
+    binary_c_write_log_code(code, sourcefile_name)
+
+    # create compilation command
+    compilation_dict = return_compilation_dict()
+
+    # Construct full command
+    command = "{cc} {ccflags} {libs} -o {outfile_name} {sourcefile_name} {inc}".format(
+        cc=compilation_dict['cc'],
+        ccflags=compilation_dict['ccflags'],
+        libs=compilation_dict['libs'],
+        outfile_name=outfile_name,
+        sourcefile_name=sourcefile_name,
+        inc=compilation_dict['inc'])
+
+    # remove extra whitespaces:
+    command = ' '.join(command.split())
+
+    # Execute compilation
+    print('Executing following command:\n{command}'.format(command=command))
+    res = subprocess.check_output('{command}'.format(command=command),
+        shell=True)
+
+    if res:
+        print('Output of compilation command:\n{}'.format(res))
\ No newline at end of file
diff --git a/binaryc_python_utils/defaults.py b/binaryc_python_utils/defaults.py
new file mode 100644
index 0000000000000000000000000000000000000000..aba0d28e9bb06819c8280885ae788180416a275d
--- /dev/null
+++ b/binaryc_python_utils/defaults.py
@@ -0,0 +1,379 @@
+# WARNING DEPRECATED FROM 11-aug-2019
+
+# File containing physics_defaults
+physics_defaults = {
+    
+    # internal buffering and compression level
+    'internal_buffering': 0,
+    'internal_buffering_compression': 0,
+    
+    # log filename
+    'log_filename': '/dev/null',
+
+    'metallicity': 0.02, # metallicity (default 0.02, solar)
+    'max_evolution_time': 13700.0, # max evol time in Myr (default WMAP result)
+
+    # stellar evolution parameters
+    'max_tpagb_core_mass': 1.38,
+    'chandrasekhar_mass': 1.44,
+    'max_neutron_star_mass': 1.8,
+    'minimum_mass_for_carbon_ignition': 1.6,
+    'minimum_mass_for_neon_ignition': 2.85,
+    'AGB_core_algorithm': 0,
+    'AGB_radius_algorithm': 0,
+    'AGB_luminosity_algorithm': 0,
+    'AGB_3dup_algorithm': 0,
+
+    # dredge up calibration (either automatic, or not)
+    'delta_mcmin': 0.0,
+    'lambda_min': 0.0,
+    'minimum_envelope_mass_for_third_dredgeup': 0.5,
+
+    # minimum timestep (1yr = 1e-6 is the default)
+    'minimum_timestep': 1e-6,
+    # maximum timestep (1 Gyr = 1e3 is the default)
+    'maximum_timestep': 1e3,
+
+    # orbit
+    'eccentricity': 0.0,
+
+    # tidally induced mass loss
+    'CRAP_parameter': 0.0,
+    
+    # tidal strength factor
+    'tidal_strength_factor': 1.0,
+
+    # E2 tidal prescription. 0 = H02, 1 = Siess+2013
+    'E2_prescription': 1, 
+
+    # gravitational radiation model
+    # 0 = H02 model (Eggleton) for J and e
+    # 1 = H02 when R<RL for both stars for J and e
+    # 2 = None
+    # 3 = Landau and Lifshitz (1951) model for J (e is not changed)
+    # 4 = Landau and Lifshitz (1951) model for J when R<RL only (e is not changed)
+    'gravitational_radiation_model': 0,
+
+    # magnetic braking multiplier
+    'magnetic_braking_factor': 1.0,
+
+    ############################################################
+    ### Mass-loss prescriptions
+    ############################################################
+
+    # turn wind mass loss on or off
+    'wind_mass_loss': 1,
+
+    # massive stars
+    'wr_wind': 0, # default hurley et al wind
+    'wr_wind_fac': 1.0, # factor applied to WR stars
+    
+    # TPAGB wind details
+    'tpagbwind': 0, # default to 0 (Karakas et al 2002)
+    'superwind_mira_switchon': 500.0,
+    'tpagb_reimers_eta': 1.0,
+
+    # eta for Reimers-like GB mass loss
+    'gb_reimers_eta': 0.5,
+
+    # VW93 alterations
+    'vw93_mira_shift': 0.0,
+    'vw93_multiplier': 1.0,
+
+    # systemic wind angular momentum loss prescription
+    'wind_angular_momentum_loss': 0,
+    'lw': 1.0,
+
+    # enhanced mass loss due to rotation
+    # 0 = none = ROTATION_ML_NONE
+    # 1 = Langer+ formula (in mass-loss rate calculation, 
+    #                      warning: can be unstable 
+    #                      = ROTATION_ML_FORMULA)
+    # 2 = remove material in a decretion disc until J<Jcrit
+    #     (ROTATION_ML_ANGMOM)
+    # 3 = 1 + 2 (not recommended!)
+    'rotationally_enhanced_mass_loss': 2,
+    'rotationally_enhanced_exponent': 1.0,
+
+    # timestep modulator
+    'timestep_modulator': 1.0,
+
+    # initial rotation rates (0=automatic, >0 = in km/s)
+    'vrot1': 0.0,
+    'vrot2': 0.0,
+
+    ########################################
+    # Supernovae and kicks
+    ########################################
+
+    # Black hole masses: 
+    # 0: H02=0
+    # 1: Belczynski
+    # 2: Spera+ 2015
+    # 3: Fryer 2012 (delayed)
+    # 4: Fryer 2012 (rapid)
+    'BH_prescription': 2,
+    'post_SN_orbit_method': 0,
+
+    'wd_sigma': 0.0,
+    'wd_kick_direction': 0,
+    'wd_kick_pulse_number': 0,
+    'wd_kick_when': 0,
+
+    # sn_kick_distribution and 
+    # sn_kick_dispersion are only defined 
+    # for SN types that leave a remnant
+    'sn_kick_distribution_II': 1,
+    'sn_kick_dispersion_II': 190.0,
+    'sn_kick_distribution_IBC': 1,
+    'sn_kick_dispersion_IBC': 190.0,
+    'sn_kick_distribution_GRB_COLLAPSAR': 1,
+    'sn_kick_dispersion_GRB_COLLAPSAR': 190.0,
+    'sn_kick_distribution_ECAP': 1,
+    'sn_kick_dispersion_ECAP': 190.0,
+    'sn_kick_distribution_NS_NS': 0,
+    'sn_kick_dispersion_NS_NS': 0.0,
+    'sn_kick_distribution_TZ': 0,
+    'sn_kick_dispersion_TZ': 0.0,
+    'sn_kick_distribution_BH_BH': 0,
+    'sn_kick_dispersion_BH_BH': 0.0,
+    'sn_kick_distribution_BH_NS': 0,
+    'sn_kick_dispersion_BH_NS': 0.0,
+    'sn_kick_distribution_AIC_BH': 0,
+    'sn_kick_dispersion_AIC_BH': 0.0,
+
+    'sn_kick_companion_IA_He': 0,
+    'sn_kick_companion_IA_ELD': 0,
+    'sn_kick_companion_IA_CHAND': 0,
+    'sn_kick_companion_AIC': 0,
+    'sn_kick_companion_ECAP': 0,
+    'sn_kick_companion_IA_He_Coal': 0,
+    'sn_kick_companion_IA_CHAND_Coal': 0,
+    'sn_kick_companion_NS_NS': 0,
+    'sn_kick_companion_GRB_COLLAPSAR': 0,
+    'sn_kick_companion_HeStarIa': 0,
+    'sn_kick_companion_IBC': 0,
+    'sn_kick_companion_II': 0,
+    'sn_kick_companion_IIa': 0,
+    'sn_kick_companion_WDKICK': 0,
+    'sn_kick_companion_TZ': 0,
+    'sn_kick_companion_AIC_BH': 0,
+    'sn_kick_companion_BH_BH': 0,
+    'sn_kick_companion_BH_NS': 0,
+
+    # evolution run splitting
+    'evolution_splitting': 0,
+    'evolution_splitting_sn_n': 10,
+    'evolution_splitting_maxdepth': 1,
+
+    ########################################
+    #### Mass transfer 
+    ########################################
+
+    # critical mass ratio for unstable RLOF 
+    #
+    # qc = m (donor) / m (accretor) : 
+    # if q>qc mass transfer is unstable
+    #
+    # H02 = Hurley et al. (2002)
+    # C14 = Claeys et al. (2014)
+
+    # non-degenerate accretors
+    'qcrit_LMMS': 0.6944, # de Mink et al 2007 suggests 1.8, C14 suggest 1/1.44 = 0.694
+    'qcrit_MS': 1.6, # C14 suggest 1.6
+    'qcrit_HG': 4.0, # H02 sect. 2.6.1 gives 4.0
+    'qcrit_GB': -1, # -1 is the H02 prescription for giants
+    'qcrit_CHeB': 3.0, 
+    'qcrit_EAGB': -1, # -1 is the H02 prescription for giants
+    'qcrit_TPAGB': -1, # -1 is the H02 prescription for giants
+    'qcrit_HeMS': 3,
+    'qcrit_HeHG': 0.784, # as in H02 2.6.1
+    'qcrit_HeGB': 0.784, # as in H02 2.6.1
+    'qcrit_HeWD': 3, # H02
+    'qcrit_COWD': 3, # H02
+    'qcrit_ONeWD': 3, # H02
+    'qcrit_NS': 3, # H02
+    'qcrit_BH': 3, # H02
+
+    # degenerate accretors
+    'qcrit_degenerate_LMMS': 1.0, # C14
+    'qcrit_degenerate_MS': 1.0, # C14
+    'qcrit_degenerate_HG': 4.7619, # C14
+    'qcrit_degenerate_GB': 1.15, # C14 (based on Hachisu)
+    'qcrit_degenerate_CHeB': 3, # not used
+    'qcrit_degenerate_EAGB': 1.15, # as GB
+    'qcrit_degenerate_TPAGB': 1.15, # as GB
+    'qcrit_degenerate_HeMS': 3,
+    'qcrit_degenerate_HeHG': 4.7619, # C14
+    'qcrit_degenerate_HeGB': 1.15, # C14
+    'qcrit_degenerate_HeWD': 0.625, # C14
+    'qcrit_degenerate_COWD': 0.625, # C14
+    'qcrit_degenerate_ONeWD': 0.625, # C14
+    'qcrit_degenerate_NS': 0.625, # C14
+    'qcrit_degenerate_BH': 0.625, # C14
+
+    # disk wind for SNeIa
+    'hachisu_disk_wind': 0, # 0 
+    'hachisu_qcrit': 1.15, # 1.15
+
+    # ELD accretion mass
+    'mass_accretion_for_eld': 0.15, # 0.15, or 100(off)
+
+    # mergers have the critical angular momentum
+    # multiplied by this factor
+    'merger_angular_momentum_factor': 1.0,
+
+    # RLOF rate method : 0=H02, 1=Adaptive R=RL, 3=Claeys et al 2014
+    'RLOF_method': 3,
+    'RLOF_mdot_factor': 1.0,
+
+    # RLOF time interpolation method
+    # 0 = binary_c (forward in time only), 1 = BSE (backwards allowed)
+    'RLOF_interpolation_method': 0,
+
+    # Angular momentum in RLOF transfer model
+    # 0 : H02 (including disk treatment)
+    # 1 : Conservative
+    'jorb_RLOF_transfer_model': 0,
+
+    # ang mom factor for non-conservative mass loss
+    # -2 : a wind from the secondary (accretor), i.e. gamma=Md/Ma (default in C14)
+    # -1 : donor (alternative in C14), i.e. gamma=Ma/Md
+    # >=0 : the specific angular momentum of the orbit multiplied by gamma
+    #
+    # (NB if Hachisu's disk wind is active, or loss is because of
+    # super-Eddington accretion or novae, material lost through the 
+    #  disk wind automatically gets gamma=-2 i.e. the Jaccretor) 
+    'nonconservative_angmom_gamma': -2,
+
+    # Hachisu's disc wind
+    'hachisu_disk_wind': 0,
+    'hachisu_qcrit': -1.0,
+
+    # donor rate limiters
+    'donor_limit_thermal_multiplier': 1.0,
+    'donor_limit_dynamical_multiplier': 1.0,
+
+    # RLOF assumes circular orbit (0) or at periastron (1)
+    'rlperi': 0,
+
+    # general accretion limits
+    'accretion_limit_eddington_multiplier': 1.0, # eddington limit factor
+    'accretion_limit_dynamical_multiplier': 1.0, # dynamical limit factor
+    'accretion_limit_thermal_multiplier': 1.0, # thermal limit on MS,HG and CHeB star factor
+    'accretion_rate_novae_upper_limit': 1.03e-7,
+    'accretion_rate_soft_xray_upper_limit': 2.71e-7,
+
+    # novae
+    'nova_retention_method': 0,
+    'nova_retention_fraction': 1e-3,
+    'individual_novae': 0,
+    'beta_reverse_nova': -1,
+    'nova_faml_multiplier': 1.0,
+    'nova_irradiation_multiplier': 0.0,
+
+    ########################################
+    # common envelope evolution
+    ########################################
+    'comenv_prescription': 0, # 0=H02, 1=nelemans, 2=Nandez+Ivanova2016
+    'alpha_ce': 1.0,
+    'lambda_ce': -1, # -1 = automatically set
+    'lambda_ionisation': 0.0,
+    'lambda_enthalpy': 0.0,
+    'comenv_splitmass': 0.0,
+    'comenv_ms_accretion_mass': 0.0,
+    'nelemans_minq': 0.0, # 0.0 min q for nelemans
+    'nelemans_max_frac_j_change': 1.0, # 1.0
+    'nelemans_gamma': 1.0, # 1.0
+    'nelemans_n_comenvs': 1, # 1
+    'comenv_merger_spin_method': 2,
+    'comenv_ejection_spin_method': 1,
+    'comenv_post_eccentricity': 0.0,
+    'comenv_splitmass': 1.01,
+
+    # comenv accretion
+    'comenv_ns_accretion_fraction': 0.0,
+    'comenv_ns_accretion_mass': 0.0,
+
+    # #################################################
+    # circumbinary disc
+    # #################################################
+    # 'comenv_disc_mass_fraction' :  0.0,
+    # 'comenv_disc_angmom_fraction' :  0.0,
+    # 'cbdisc_gamma' :  1.6666666666,
+    # 'cbdisc_alpha' :  1e-6,
+    # 'cbdisc_kappa' :  1e-2,
+    # 'cbdisc_torquef' :  1.0,
+    # 'cbdisc_mass_loss_constant_rate' :  0.0,
+    # 'cbdisc_mass_loss_inner_viscous_accretion_method' :  1,
+    # 'cbdisc_mass_loss_inner_viscous_multiplier' :  1.0,
+    # 'cbdisc_mass_loss_inner_L2_cross_multiplier' :  0.0,
+    # 'cbdisc_mass_loss_ISM_ram_pressure_multiplier' :  0.0,
+    # 'cbdisc_mass_loss_ISM_pressure' :  3000.0,
+    # 'cbdisc_mass_loss_FUV_multiplier' :  0.0,
+    # 'cbdisc_mass_loss_Xray_multiplier' :  1.0,
+    # 'cbdisc_viscous_photoevaporation_coupling' :  1,
+    # 'cbdisc_inner_edge_stripping' :  1,
+    # 'cbdisc_outer_edge_stripping' :  1,
+    # 'cbdisc_minimum_luminosity' :  1e-4,
+    # 'cbdisc_minimum_mass' :  1e-6,
+    # 'cbdisc_eccentricity_pumping_method' :  1,
+    # 'cbdisc_resonance_multiplier' :  1.0,
+    # 'comenv_post_eccentricity' :  1e-5,
+
+    ##################################################
+    # wind accretion
+    ##################################################
+
+    # Bondi-Hoyle accretion multiplier
+    'Bondi_Hoyle_accretion_factor': 1.5,
+    # Wind-RLOF method: 0=none, 1=q-dependent, 2=quadratic
+    # (See Abate et al. 2012,13,14 series of papers)
+    'WRLOF_method': 0,
+
+    # pre-main sequence evolution
+    'pre_main_sequence': 0,
+    'pre_main_sequence_fit_lobes': 0,
+
+    ########################################
+    # Nucleosynthesis
+    ########################################
+
+    # lithium
+    'lithium_hbb_multiplier': 1.0,
+    'lithium_GB_post_1DUP': 0.0,
+    'lithium_GB_post_Heflash': 0.0,
+
+    ########################################
+    # Yields vs time (GCE)
+    ########################################
+
+    'yields_dt': 100000,
+    'escape_velocity': 1e9, # if wind v < this, ignore the yield
+    # and assume it is lost to the IGM
+    'escape_fraction': 0.0, # assume all yield is kept in the population
+
+    # minimum sep/per for RLOF on the ZAMS
+    'minimum_separation_for_instant_RLOF': 0,
+    'minimum_orbital_period_for_instant_RLOF': 0, 
+}
+
+
+
+
+
+
+
+
+
+        
+
+
+    
+
+
+
+
+
+
+
diff --git a/binaryc_python_utils/functions.py b/binaryc_python_utils/functions.py
new file mode 100644
index 0000000000000000000000000000000000000000..d12a3e6bf9bd02efe0237906dd8da2da45926483
--- /dev/null
+++ b/binaryc_python_utils/functions.py
@@ -0,0 +1,145 @@
+import binary_c
+
+from collections import defaultdict
+from binaryc_python_utils.defaults import physics_defaults
+
+def create_arg_string(arg_dict):
+    """
+    Function that creates the arg string
+    """
+    arg_string = '' 
+    for key in arg_dict.keys():
+        arg_string += "{key} {value} ".format(key=key, value=arg_dict[key])
+    arg_string = arg_string.strip()
+    return arg_string
+
+def get_defaults():
+    """
+    Function that calls the binaryc get args function and cast it into a dictionary
+    All the values are strings
+    """
+    default_output = binary_c.return_arglines()
+    default_dict = {}
+
+    for default in default_output.split('\n'):
+        if not default  in ['__ARG_BEGIN', '__ARG_END', '']:
+            key, value = default.split(' = ')
+
+            # Filter out NULLS (not compiled anyway)
+            if not value in ['NULL', 'Function']:
+                if not value=='':
+                    default_dict[key] = value
+    return default_dict
+
+def get_arg_keys():
+    """
+    Function that return the list of possible keys to give in the arg string
+    """
+
+    return get_defaults().keys()
+
+def run_system(**kwargs):
+    """
+    Wrapper to run a system with settings 
+    """
+
+    # Load default args
+    args = get_defaults()
+    # args = {}
+
+    # For example
+    # physics_args['M_1'] = 20
+    # physics_args['separation'] = 0 # 0 = ignored, use period
+    # physics_args['orbital_period'] = 100000000000 # To make it single
+
+    # Use kwarg value to override defaults and add new args
+    for key in kwargs.keys():
+        args[key] = kwargs[key]
+
+    # Construct arguments string and final execution string
+    arg_string = create_arg_string(args)
+    arg_string = f'binary_c {arg_string}' 
+
+    # print(arg_string)
+
+    # Run it and get output
+    buffer = ""
+    output = binary_c.run_binary(arg_string)
+
+    return output
+
+
+def run_system_with_log(**kwargs):
+    """
+    Wrapper to run a system with settings AND logs the files to a designated place defined by the log_filename parameter.
+    """
+
+    # Load default args
+    args = get_defaults()
+    # args = {}
+
+    # For example
+    # physics_args['M_1'] = 20
+    # physics_args['separation'] = 0 # 0 = ignored, use period
+    # physics_args['orbital_period'] = 100000000000 # To make it single
+
+    # Use kwarg value to override defaults and add new args
+    for key in kwargs.keys():
+        args[key] = kwargs[key]
+
+    # Construct arguments string and final execution string
+    arg_string = create_arg_string(args)
+    arg_string = f'binary_c {arg_string}' 
+    
+    # print(arg_string)
+
+    # Run it and get output
+    buffer = ""
+    output = binary_c.run_binary_with_log(arg_string)
+
+    return output
+
+def parse_output(output, selected_header):
+    """
+    Function that parses output of binaryc when it is construction like this:
+    DAVID_SINGLE_ANALYSIS t=0 mass=20 
+
+    You can give a 'selected_header' to catch any line that starts with that. 
+    Then the values will be put into a 
+    """
+    value_dicts = []
+    val_lists = []
+
+    # split output on newlines
+    for i, line in enumerate(output.split('\n')):
+        # Skip any blank lines
+        if not line=='':
+            split_line = line.split()
+
+            # Select parts
+            header = split_line[0]
+            value_array = split_line[1:]
+
+            # Catch line starting with selected header
+            if header==selected_header:
+                # print(value_array)
+                # Make a dict 
+                value_dict = {}
+                for el in value_array:
+                    key, val = el.split('=')
+                    value_dict[key] = val
+                value_dicts.append(value_dict)
+
+    if len(value_dicts)==0:
+        print('Sorry, didnt find any line matching your header {}'.format(selected_header))
+        return None
+
+    keys = value_dicts[0].keys()
+
+    # Construct final dict.
+    final_values_dict = defaultdict(list)
+    for value_dict in value_dicts:
+        for key in keys:
+            final_values_dict[key].append(value_dict[key])
+
+    return final_values_dict
\ No newline at end of file
diff --git a/binaryc_python_utils/stellar_types.py b/binaryc_python_utils/stellar_types.py
new file mode 100644
index 0000000000000000000000000000000000000000..8f947f28bca95043af541510d840b79429d1e6d1
--- /dev/null
+++ b/binaryc_python_utils/stellar_types.py
@@ -0,0 +1,18 @@
+stellar_type = {
+    0: 'low mass main sequence', 
+    1: 'Main Sequence',
+    2: 'Hertzsprung Gap',
+    3: 'First Giant Branch', 
+    4: 'Core Helium Burning',
+    5: 'Early Asymptotic Giant Branch',
+    6: 'Thermally Pulsing', 
+    7: 'NAKED_MAIN_SEQUENCE_HELIUM_STAR',
+    8: 'NAKED_HELIUM_STAR_HERTZSPRUNG_GAP',
+    9: 'NAKED_HELIUM_STAR_GIANT_BRANCH',
+    10: 'HELIUM_WHITE_DWARF', 
+    11: 'CARBON_OXYGEN_WHITE_DWARF',
+    12: 'OXYGEN_NEON_WHITE_DWARF',
+    13: 'NEUTRON_STAR', 
+    14: 'BLACK_HOLE', 
+    15: 'MASSLESS REMNANT'
+}
\ No newline at end of file
diff --git a/python_API_test.py b/python_API_test.py
index bbba1d945e24ed8fd0df2c60dd33fcf2cea920f0..fb77ec234976cdeb13e76c336c7563842eb6c97d 100755
--- a/python_API_test.py
+++ b/python_API_test.py
@@ -7,8 +7,6 @@ import binary_c
 # module.
 ############################################################
 
-
-
 def run_test_binary():
     m1 = 15.0 # Msun
     m2 = 14.0 # Msun