Merge development

This replaces #47 with a much cleaner set of commits.