Implements #1152
Implements first version of  #1152