Refucktored the ExtractToMethod function