refactor method.