changed code to fit in page margins