Added critical loop structure for get_source_line and other changes