separating some code to make it more understandable.
separating some code to make it more understandable.

Change-Id: I3bcb38947f05cc38badd2676ab1cb6939396b6ee

WeaveTeam/WeaveJS,WeaveTeam/WeaveJS,WeaveTeam/WeaveJS,WeaveTeam/WeaveJS