This commit refs #1, #2 and fixes #822