Pr 68 rebased

Re-open pull request that was apparently not merged, this time rebased on master to check that travis is green.