Move command checking to separate function