Finished Chapter 5 -- added collision detection