Adding Dan's latest changes