Refactoring. Building failed. next step is fixing the algorithm part.