rename function
clean up newlines at EOB when appropriate

#1