Added if then statement to index file