Added Method Function

After having problems with previous code, added a new function method.
Although, it is still not working properly.