basic implementation of issue #40