committed everything in methods and recursion