Trimming white space before inserting or deleting, as per pmeth's request