reduce the size of the string that's sent to javascript