Implemented recursive upgrade mechanism (see #16).