rewrite 'newline' implementation