Refactored a little of Realtime client