add processPlayingState function