new version, better plotting