Improved Static Text class to avoid memory leaks