Added escape and unescape script methods + various fixes