implemented solution to method problem