updated to work without socket.io