MOSYNC-3271. Added Fredrik's changes. Part 2