Implements #1166