task navigation code made more clear