Some header management and sdl optimizations
Merge branch 'master'