index added as argument to function