fixed bugs and added string splicing