Added support for going back, fixed variable naming.