Implementation of #56.