sorted the items properly