Database transaction and error handling now ok for transactional databases, also did logging differently