Some work done in issue #5