revised, with printing option