Refactored the code
more work
Made some good changes to the testing branch, reworked a lot of it.
EDF and RM now work (and the implementation makes more sene than master)