The -5 is also incorrect. ".rss" is only 4 characters and the -5 would never equal .rss. However with those changes edited into the code, the function did make a copy of all the spritesets but none of the directional values were changed to lower case.