added logic to prevent the same track from being played again