added cursors where needed