Features from @tbunnyman

This contains the changes from #206, #207, and #208 rebased on top of the latest master.