merging ted's latest changes