Redone code which vanished after commit 65dbb2909b