Re-base and merge changes of PR 131

Re-base and merge changes of PR 131

Please review and merge