Extract changes by @synesthesiam in PR #797