Fix #241, check if dot after newline, and change indentation
Use _last_index_of to join as little as possible