initial work for issue 399

not ready for merging
These would seem to bear no relation to the name of the branch -- it's ok, but in general we would like separate pull requests for separate refactoring :).