refactor using methods