refactor from IDLE