refactor trader