new algo to be continued (add track boundary)