Implementation for issue #174.