remove trailing blank lines
cleanup and some tests