adding code for finding double successor