Made some changes to resolve function.