Merged changes from tpruvot.