Move autocutsel code here