refactor path finding model