Removed senseless typecasts by proper function definitions in vectorized
routine