give the foreach function some context