Cleanup, tweaks, fixes

* Fixed codec info
* Refactored a lot of code
I guess this is stage 3 of refactoring and stuff?