Including some of Yans suggested changes