Updating from PR #217 by CedCannes