Copying some changes from work.