improved string splicing