some refactoring to use 'sdl' and logging