cleanup and text reformatting