Fixing a few minor bugs. Using minimum no of threads/blocks as supported
Addressing code review comments obtained. Moving the code to c_support_apply_code  and handling the cases for launching the threads and blocks to be minimum of thresh-hold or what is required