add sorting (but bad work)