moves to using userData variable instead of global variables so that we can easily integrate having multiple users running in one process when we do websockets