refactoring on setup method