Code cleanup: use Cursor object.
Further code cleanup.
Added: named cursors.