added timeout, preparing for websockets