first implementation of issue #30