Updated trim whitespace to return cursor to starting position