Added some new sql commands and explicit commit after each transaction.