refactor with method extract