The code is slightly simplified.