add third loop