add if statement to index