Some re-organization for clearer understanding of the order in which
events are occuring in the code.