fixed euclidean distance and boolean flag, adding more features like automatic download scenarios.