changed the find_loop_start() implementation so it does not require modifying the list anymore