Refector Code to Methods