Using sort_by_weight()
Fixed file mode