More flexible sprite system and improvements to the state system.