     // MARK: - private functions
 
     private func touchDown(atPoint pos : CGPoint) {
-        targetXPostion = pos.x
+        target = pos.x
         print("Down")
-        print("new target position X: \(targetXPostion)")
+        print("new target position X: \(target)")
     }
 
     private func touchMoved(toPoint pos : CGPoint) {
-        targetXPostion = pos.x
+        target = pos.x
         print("Moved")
-        print("new target position X: \(targetXPostion)")
+        print("new target position X: \(target)")
     }
 
     private func touchUp(atPoint pos : CGPoint) {
-        targetXPostion = pos.x
+        target = pos.x
         print("Up")
-        print("new target position X: \(targetXPostion)")
+        print("new target position X: \(target)")
+
+        if personNode.hasActions() {
+            personNode.removeAllActions()
+        }
 
         var turnInAction = SKAction.getTurnInLeftAction()
-        if personNode.position.x < targetXPostion {
+        if personNode.position.x < target {
             turnInAction = SKAction.getTurnInRightAction()
         }
         
         personNode.run(turnInAction) {
-            self.walkAction(to: self.targetXPostion)
+            self.walkAction(to: self.target)
         }
     }
 

        self.addChild(personNode)

        oneStepLength = personTexture.size().width/2

        // Create shape node to use during mouse interaction
        let w = (self.size.width + self.size.height) * 0.05
        self.spinnyNode = SKShapeNode.init(rectOf: CGSize.init(width: w, height: w), cornerRadius: w * 0.3)
        
        if let spinnyNode = self.spinnyNode {
            spinnyNode.lineWidth = 2.5
            
            spinnyNode.run(SKAction.repeatForever(SKAction.rotate(byAngle: CGFloat(Double.pi), duration: 1)))
            spinnyNode.run(SKAction.sequence([SKAction.wait(forDuration: 0.5),
                                              SKAction.fadeOut(withDuration: 0.5),
                                              SKAction.removeFromParent()]))
        }
    }
    

    
    override func mouseDown(with event: NSEvent) {
        self.touchDown(atPoint: event.location(in: self))
    }

    private let personTexture: SKTexture = SKTexture(image: #imageLiteral(resourceName: "idle_1"))
    private var personNode: SKSpriteNode!
    
    private var target: CGFloat! //X target position
    
    private var ground: SKSpriteNode?

    private var oneStepLength: CGFloat = 0
