added a method1 and modified the code partially suitable for it