Improved stringfunc