Hartog's Theorem and the Axiom of Replacement

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:

Let *X* be the set of ordinals of well-orderings of subsets of *A*. Let α be the least ordinal not in *X*.

Let *h*(*A*)={β:β < α}. Then α = ord (*h*(*A*)) ∉ *X*. Suppose we had an injection *f*:*h*(*A*)→ *A*. Then the image if *f* is a well ordered subset of *A* and so its ordinal (which is α) is in *X*, a contradiction.

Our definition of the Axiom of Replacement is: Let *x* be any set. Let *H* be a well-defined operation which assigns sets to members of *x*. Then there is a set whose members are exactly *H*(*a*) for all *a* ∈ *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?