Partial implementation of issue #25