Added timeout function to redirect to index page