Added some methods and solved problem1