add str_remaining() and tests