refactor delegate