Model: Way algorithm refactoring