updated gallery sort