Moved try-catch block, so indexing continues after errors