Made it work for a variable number of input arguments.