Tried optimizing time/dist problem