Refactoring gcm api