closegain modified to accept variable arguments