Here is a link to a post providing a justification and pseudo-code for the complete implementation of the iterative refinement technique, essentially the same as @ctkelley suggested.