Update collision detection code. Moved to Entity class.