refacotred newline insertion