simplify initialising result_length