would it make sense to have a function, last_non_whitespace ? that would return a pointer to the end?