Adding is function for ending game