Pull Martins branch

Merging Martin's work into master branch.