refactor gcm messaging