A more elegant version