Edits to main, L pars, very slow dist function when N = 10 and W = 100