How to group my apps together on my iphone?

I recently deleted a lot of apps on my iphone 3gs to make room for more memory. However, this has left a lot of gaps between the apps on a lot of different pages. Is there an easy way of making the apps all group back up together next to each other or will I have to manually drag each one of them next to each other?

Manually drag, or when the tiles are shaking just shake your phone and it organizes it for you