cleaned-up leg tracking