Add inTransaction function