revise loop method