new function to delete trailing white spaces