add end play logic