First implementation of issue #16