Fix keywords array generator to re-index the array after removing dups
Setup try-catch loop to actually use database transactions