This implementation does not seem to take transactions into account. How is it recommended to implement it?