adding second leg functions