finish the scattering part, but some bugs exist