using curves to optimise path, working well