Added the foreach binding and some changes needed for it