Move checker logic into separate function