move code to the method