Fixes #342. Starts #340