added cursors and ForEach