added collision detection and link following