Made automatic insertion one-step, rather than one character at a time

some refactoring