Updated activity deleting logic.