Feature fix #126

This is not ready to merge yet, but it is open for review.