Some work mainly towards issue #31