Fix buffer-switching after rendering. Fix file-encoding.
Add debug-mode. Add better test-data.