eliminate duplication in method get_line_moves