implement it by a smater way