Adding optional contiglength parameter to allow setting the minimum returned length