Cleanup, refactoring, updated transaction