made printing into a sseperate method