Merge refactor result from 'master' into riversyang.