Refactored path tracking. Works with one object.