Added back flag sorting support