Improved code for swithing images for sprites

Still not as clean as I'd like it.
Removed redundant includes