merge from master and refactor.