Partial implementation of #121