inserted functionality out of pull-request #4