SDL implementation
SDL implmentation bug fixes