new version with demo and tests