eliminate cycles & delete useless comments