Refactored code complexity
More refactorings
Added debug assert for window display
Added another assert for sprites