top-sort added