reordered code, pulled out a "playTrack" function