Code snippet for rebuilding facebook chat