Define this function outside of the method, otherwise it just gets created and thrown away each time the method completes.