Change cloud message handler creation algorithm