remove extraneous text and code