WIP for issue #81

Need to test it.