move unnecessary global variables ordinates_tdo, ordinates into the only function where they were used