new version with a few fixes