code merge from ashish/ravi
merge upstream master