Refactoring, including removing dynamic resampling (no advatange over MLE)
Further work on refactoring of library