Merge changes I52f70756,Icc621f0a

* changes:
  [NS A08] Tiny refactoring
  [NS A07] Move the last side effects out of the decision loop.
tree: 4a6d264654d38844a4fa45f5e97b755ab452f6da
  1. core/
  2. services/
  3. tests/