Modified conditions for converting cursors to arrays