modified the code so that the whole thing can be made to fit in a page