got function working to put data in correct format for line drawing