Refactored sdl