added quadtree and collision detection.