dynamically create threads from input argument