Updated code to have time be xValue