commented and fixed successor generator method