factored out maxby into test