new version, better output