Removing class on form wizard step nav

Removing class on form wizard step nav

A poster here was awesome in helping me add a class to visited steps with Jankoatwarpspeed's form wizard plugin. Modified code here: http://pastebin.com/YxZRDEda

The only issue is that when you move back via the back button it doesn't remove the newly applied visited class, anyone have any ideas?