Refactor transactions (not compiled)