tested by three cases, now v1.0