Implementation of #4.