Improved handling of sprites, added example for sprite