moved euclidian function to helpers