Refactoring + PM solving