Thanks Tim Graham for the review and suggestions. d19109fd37e75ccf29d2ca64370102753dbc7c5b from master.