Sure, I also want to move this code to a function like setClamp etc. But in this function (setClamp), there will be a  fistful of if statement for different kind of texture, But I would like to have a try again.