Refactored to seperate algorithm from exploration view