Made deleting and substituting work