Refactoring Libmarpa