made it actually work for 'n' numbers-as long as there aren't too many for the input array