Removed the outer for loop

Used component wise multiplication of B instead of for loop.