MOSYNC-3271. Added Fredrik's changes.