add loop implementation