Leftover commit from merging branches.

Revert if need be.
Fixed audio playback.

Also used state instead of indexes.