Adding code for condition size % num_threads != 0