Fixes #55. Related to #52 #53 #54 . Fixes #31.