Slightly more elegant implementation again.