(Frontend) Refactor frontend main iterate function again