improve logic.