Initial version of #1290