Extract execution code as a method