Squashed some bugs. Added index parameter, which controls sorting of slides