WIP
Further WIP, fix logging
More fixes

Still some pointer stuff not working correctly in h1_function.
Also make h1-function static, and more fixes
Forgot a minimum calculation
Fix a wrong abs() calculation
More warnings
Small fixes
Initial cleanup
More cleanup
Even more cleanup