Indentation of this function varies pretty wildly :-).