robot refactor