implementation of review comments from @wenns