Added code to dynamically update the graph every 5 seconds