add "if" statement with variable validation