Move writing to the file of 1d parameters somewhere out of main
Move all headers to the header files and code to cpp files (if it is possible everywhere).