routeToProject function amended to recognize widget context