Created method and put code in method.