I've been given a question asking me to re write our proof of Hartog's theorem highlighting where the Axiom of Replacement is used.

Our proof of Hartog's theorem goes thusly:

LetXbe the set of ordinals of well-orderings of subsets ofA. Let α be the least ordinal not inX.

Leth(A)={β:β < α}. Then α = ord (h(A)) ∉X. Suppose we had an injectionf:h(A)→A. Then the image iffis a well ordered subset ofAand so its ordinal (which is α) is inX, a contradiction.

Our definition of the Axiom of Replacement is: Letxbe any set. LetHbe a well-defined operation which assigns sets to members ofx. Then there is a set whose members are exactlyH(a) for alla∈x.

I can sort of see how the axiom is used in the second paragraph of Hartog's proof. We need to construct the function H like in the axiom, defining an operation between each (h(A), <) (< is a well order) to α. But it's difficult getting my head round these definitions, so could someone help me out a bit with this?