     
     @IBAction func toggleRightTime(_ sender: AnyObject) {
         rightTimeIsDuration = !rightTimeIsDuration
-        //updateTime()
+        updateTime()
     }
 }
 
 extension PopOverViewController:  MusicPlayerManagerDelegate {
     func manager(_ manager: MusicPlayerManager, trackingPlayer player: MusicPlayer, didChangeTrack track: MusicTrack, atPosition position: TimeInterval) {
-        print(position)
-        print(track.duration)
-        print("POSITION LKSJFLK JDFLKJ SDFL KJSDLFKJSDLF JSDLKF JSLF JDS")
+        self.duration = track.duration
+        self.position = position
         updateInfo(track: track)
     }
     
     func manager(_ manager: MusicPlayerManager, trackingPlayer player: MusicPlayer, playbackStateChanged playbackState: MusicPlaybackState, atPosition position: TimeInterval) {
+        self.position = position
+        switch playbackState {
+        case .playing, .fastForwarding, .rewinding, .reposition:
+            self.isPlaying = true
+        default:
+            self.isPlaying = false
+        }
         updateInfo(track: player.currentTrack)
         updateButton(state: playbackState)
     }

            titleLabel.textColor = NSColor.gray
        }


//        let position = SpotifyAppleScript.currentTrack.positionPercentage
//        positionSlider.doubleValue = floor(position * 100)

        updateTime(track: track)
    }
    
    // MARK: - Private methods
    
    fileprivate func updateTime(track: MusicTrack?) {
        if let track = track {
//            let leftTimeTuple = secondsToHoursMinutesSeconds(seconds: track.position)
//            leftTime.stringValue = getTimeString(tuple: leftTimeTuple)
            
            
            switch rightTimeIsDuration {
            case true:
                let rightTimeTuple = secondsToHoursMinutesSeconds(seconds: track.duration/1000)
                rightTime.stringValue = getTimeString(tuple: rightTimeTuple)
            case false: break
//                let rightTimeTuple = secondsToHoursMinutesSeconds(seconds: track.duration - track.position)
//                rightTime.stringValue = "-" + getTimeString(tuple: rightTimeTuple)
            }
        }
    }

    private func updateButton(state: MusicPlaybackState?) {

    private var lastArtworkUrl = ""
    fileprivate var rightTimeIsDuration: Bool = true
    private var defaultImage: NSImage!
    private var musicPlayerManager: MusicPlayerManager!
    private var position: Double = 0
    private var duration: Double = 0
    private var isPlaying: Bool = false
    private var timer: Timer!
    
    // MARK: - IBOutlets
    
