--modified with latest changes