Add file checking to if statements