added Track IDs; corrected direction calculations