Added collision detection for left and upper wall.