restructured code, removed printing class