modified variable indexing so that multiple problems can be run in same script