move out of onMessage