Sorted was not being passed if instantiating via function