I do not know what do you mean by "some part of it seem quite complex"? Which part?
Do you mean: how I processed the collision between two particles in two dimension?
If it is the case, please check out [url=http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=4.0]2D Collision[/url]
You will find out how it was calculated and how the code was implemented (with source code).