Merge the dangling dev branch stuff back into master

fixes #335.