remove extraneous partials, add final new lines