ok everything is here, only need loop algo