Allchanges

This contains all changes from #14, #15 and #16 all rebased and updated so they work nicely together.

I submitted separately so they can be reviewed independently, but if you prefer this one is ready to go.