Refactoring of spritebatch.