Changes from Johan

Use this pull request to merge and track stuff added by Johan.

(I think it is possible to do selective merge of singe commits, without closing the pull request)