refactor the manager