Implements #646
Implements #647