Move screen detection in a function